Submission #17423

# Submission time Handle Problem Language Result Execution time Memory
17423 2015-12-01T12:56:09 Z choyi0521 Three Friends (BOI14_friends) C++
Compilation error
0 ms 0 KB
#include<iostream>
using namespace std;
const int MAX_N=2000001;
int n;
char str[MAX_N+1];
int main(){
	cin >> n >> str;
	int i,tmp=0;
	for(i=0; i<n/2 && str[i]==str[n/2+i]; i++);
	for(; i<n/2 && str[i]==str[n/2+1+i]; i++);
	if(i==n/2) tmp+=1;
	for(i=0; i<n/2 && str[i]==str[n/2+1+i]; i++);
	for(; i<n/2 && str[i+1]==str[n/2+1+i]; i++);
	if(i==n/2) tmp+=2;
	str[n/2]=0;
	if(tmp==0 || n%2==0) cout<<"NOT POSSIBLE";
	else if(tmp==3 && strcmp(str,str+n/2+1)) cout << "NOT UNIQUE";
	else if(tmp==1) cout<<str;
	else cout<<str+n/2+1;
	return 0;
}

Compilation message

friends.cpp: In function ‘int main()’:
friends.cpp:17:40: error: ‘strcmp’ was not declared in this scope
  else if(tmp==3 && strcmp(str,str+n/2+1)) cout << "NOT UNIQUE";
                                        ^