Submission #944680

#TimeUsernameProblemLanguageResultExecution timeMemory
944680tamir1Three Friends (BOI14_friends)C++17
0 / 100
1020 ms6220 KiB
#include<bits/stdc++.h> #define ll long long using namespace std; ll n,i,j,cnt,ans; string t,u,s; bool check(string s){ ll n=s.size(),i; for(i=0;i<n/2;i++){ if(s[i]!=s[i+n/2]) return 0; } return 1; } int main(){ cin >> n >> u; if(n%2==0){ cout << "NOT POSSIBLE"; return 0; } for(i=0;i<n;i++){ t.clear(); for(j=0;j<n;j++){ if(j==i) continue; t=t+u[j]; } if(check(t)){ ans=i; cnt++; s=t; } } if(cnt==0) cout << "NOT POSSIBLE"; else if(cnt>1) cout << "NOT UNIQUE"; else{ for(i=0;i<s.size()/2;i++) cout << s[i]; } }

Compilation message (stderr)

friends.cpp: In function 'int main()':
friends.cpp:34:12: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   34 |   for(i=0;i<s.size()/2;i++) cout << s[i];
      |           ~^~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...