Submission #944675

#TimeUsernameProblemLanguageResultExecution timeMemory
944675tamir1Three Friends (BOI14_friends)C++17
0 / 100
1045 ms9128 KiB
#include<bits/stdc++.h> #define ll long long using namespace std; ll n,i,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=u; t.erase(t.begin()+i); 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:31: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]
   31 |   for(i=0;i<s.size()/2;i++) cout << s[i];
      |           ~^~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...