Submission #953606
Source Code Expand
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define pii pair<int,int>
#define pll pair<ll,ll>
#define pdd pair<double,double>
#define X first
#define Y second
#define REP(i,a) for(int i=0;i<a;++i)
#define REPP(i,a,b) for(int i=a;i<b;++i)
#define FILL(a,x) memset(a,x,sizeof(a))
#define foreach( gg,itit ) for( typeof(gg.begin()) itit=gg.begin();itit!=gg.end();itit++ )
#define mp make_pair
#define pb push_back
#define all(s) s.begin(),s.end()
#define present(c,x) ((c).find(x) != (c).end())
const double EPS = 1e-8;
const int mod = 1e9+7;
const int N = 1e6+10;
const ll INF = 1e18;
//#define DEBUG
ll power(ll x,ll y){
ll t=1;
while(y>0){
if(y%2) y-=1,t=t*x%mod;
else y/=2,x=x*x%mod;
}
return t;
}
#ifdef DEBUG
#define dprintf(fmt,...) fprintf(stderr,fmt,__VA_ARGS__)
#else
#define dprintf(fmt,...)
#endif
char s[N],r[N];
int main(){
int n;
scanf("%d%s%s",&n,s,r);
REP(i,n){
int f=0;
REPP(j,i,n){
if(s[j]!=r[j-i]) f=1;
}
if(f==0){
printf("%d\n",n+i); exit(0);
}
}
printf("%d\n",2*n);
return 0;
}
Submission Info
Submission Time
2016-10-29 21:04:59+0900
Task
A - Prefix and Suffix
User
alecsyde
Language
C++14 (GCC 5.4.1)
Score
200
Code Size
1134 Byte
Status
AC
Exec Time
3 ms
Memory
256 KB
Compile Error
./Main.cpp: In function ‘int main()’:
./Main.cpp:40:25: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
scanf("%d%s%s",&n,s,r);
^
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
2 ms
256 KB
0_01.txt
AC
3 ms
256 KB
0_02.txt
AC
3 ms
256 KB
1_00.txt
AC
3 ms
256 KB
1_01.txt
AC
2 ms
256 KB
1_02.txt
AC
2 ms
256 KB
1_03.txt
AC
3 ms
256 KB
1_04.txt
AC
3 ms
256 KB
1_05.txt
AC
3 ms
256 KB