Submission #1134559


Source Code Expand

#include<cstdio>
#include<cstring>
#include<vector>
#include<queue>
#include<algorithm>
#include<cmath>
#include<climits>
#include<string>
#include<set>
#include<map>
#include<iostream>
using namespace std;
#define rep(i,n) for(int i = 0;i<((int)(n));i++)
#define reg(i,a,b) for(int i = ((int)(a));i<=((int)(b));i++)
#define irep(i,n) for(int i = ((int)(n)-1);i>=0;i--)
#define ireg(i,a,b) for(int i = ((int)(b)-1);i>=((int)(a));i--)
typedef long long int lli;
typedef pair<int, int> mp;
#define fir first
#define sec second
#define IINF INT_MAX
#define LINF LLONG_MAX
#define eprintf(...) fprintf(stderr,__VA_ARGS__)
#define pque(type) priority_queue<type,vector<type>,greater<type> >
#define memst(a,b) memset(a,b,sizeof(a))

int main(void){
	int n; scanf("%d", &n);
	char s[n], t[n]; scanf("%s", &s); scanf("%s", &t);
	
	int i = 0;
	for(;i<n;i++){
		bool f = true;
		reg(j, i, n-1){
			if(s[j] != t[j-i]){
				f = false;
				break;
			}
		}
		if(f) break;
	}
	
	cout << 2*n - (n-i) << endl;	
	
	return 0;
}

Submission Info

Submission Time
Task A - Prefix and Suffix
User ktyshmt
Language C++14 (GCC 5.4.1)
Score 200
Code Size 1054 Byte
Status AC
Exec Time 1 ms
Memory 256 KB

Compile Error

./Main.cpp: In function ‘int main()’:
./Main.cpp:29:33: warning: format ‘%s’ expects argument of type ‘char*’, but argument 2 has type ‘char (*)[n]’ [-Wformat=]
  char s[n], t[n]; scanf("%s", &s); scanf("%s", &t);
                                 ^
./Main.cpp:29:50: warning: format ‘%s’ expects argument of type ‘char*’, but argument 2 has type ‘char (*)[n]’ [-Wformat=]
  char s[n], t[n]; scanf("%s", &s); scanf("%s", &t);
                                                  ^
./Main.cpp:28:24: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
  int n; scanf("%d", &n);
                        ^
./Main.cpp:29:34: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
  char s[n], t[n]; scanf("%s", &s); scanf("%s", &t);
                                  ^
./Main.cpp:29:51: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_un...

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 200 / 200
Status
AC × 3
AC × 9
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