Submission #1406809
Source Code Expand
#include <iostream> #include <stack> #include <cstdio> #include <cstdlib> #include <cmath> #include <string> #include <vector> #include <queue> #include <map> #include <set> #include <tuple> #include <algorithm> #include <functional> #include <cstring> #include <limits.h> #define FOR(i,k,n) for (int i=(k); i<(int)(n); ++i) #define REP(i,n) FOR(i,0,n) #define FORIT(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i) #define SZ(i) ((int)i.size()) #define pb push_back #define mp make_pair #define mt make_tuple #define get0(x) (get<0>(x)) #define get1(x) (get<1>(x)) #define get2(x) (get<2>(x)) #define ALL(X) (X).begin(),(X).end() #define LLMAX 9223372036854775807LL #define LLMIN -9223372036854775808LL #define IMAX 2147483647 #define IMIN -2147483648 typedef long long LL; using namespace std; int main(void){ int N; string s,t; cin>>N>>s>>t; REP(i,N){ int f=true; FOR(j,i,N) if(s[j]!=t[j-i]) f=false; if(f){ cout<<N+i<<endl; return 0; } } cout<<2*N<<endl; return 0; }
Submission Info
Submission Time | |
---|---|
Task | A - Prefix and Suffix |
User | a_kawashiro |
Language | C++14 (GCC 5.4.1) |
Score | 200 |
Code Size | 1220 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 |