Submission #1150859
Source Code Expand
#include <iostream> #include <algorithm> #include <cmath> #include <string> #include <array> #include <vector> #include <functional> #include <numeric> #include <limits> using namespace std; int main(void) { int n; string s, t, s2, t2; cin >> n >> s >> t; for (int i = n-1; i >= 0; i--) { for (int j = 0; j <= i; j++) { s2 += s[n - i - 1 + j]; t2 += t[j]; } if (s2 == t2) { t.erase(t.begin(), t.begin() + i+1); s += t; cout << s.size() << endl; return 0; } t2.clear(); s2.clear(); } s += t; cout << s.size() << endl; return 0; }
Submission Info
Submission Time | |
---|---|
Task | A - Prefix and Suffix |
User | tmtm_nanana |
Language | C++14 (GCC 5.4.1) |
Score | 200 |
Code Size | 603 Byte |
Status | AC |
Exec Time | 1 ms |
Memory | 256 KB |
Judge Result
Set Name | Sample | All | ||||
---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 200 / 200 | ||||
Status |
|
|
Set Name | Test Cases |
---|---|
Sample | 0_00.txt, 0_01.txt, 0_02.txt |
All | 0_00.txt, 0_01.txt, 0_02.txt, 1_00.txt, 1_01.txt, 1_02.txt, 1_03.txt, 1_04.txt, 1_05.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
0_00.txt | AC | 1 ms | 256 KB |
0_01.txt | AC | 1 ms | 256 KB |
0_02.txt | AC | 1 ms | 256 KB |
1_00.txt | AC | 1 ms | 256 KB |
1_01.txt | AC | 1 ms | 256 KB |
1_02.txt | AC | 1 ms | 256 KB |
1_03.txt | AC | 1 ms | 256 KB |
1_04.txt | AC | 1 ms | 256 KB |
1_05.txt | AC | 1 ms | 256 KB |