Submission #346359

#TimeUsernameProblemLanguageResultExecution timeMemory
346359salehThree Friends (BOI14_friends)C++17
0 / 100
1093 ms12048 KiB
#include <bits/stdc++.h> using namespace std; int main() { string s, t, ans; ans.clear(); cin >> s >> s; if ((s.size() & 1) == 0) return cout << "NOT POSSIBLE\n", 0; for (int i = 0; i < s.size(); i++) { t = s.substr(0, i) + s.substr(i + 1, s.size() - i - 1); if (t.substr(0, t.size() >> 1) == t.substr(t.size() >> 1, t.size() >> 1)) { if (ans.empty()) ans = t.substr(0, t.size() >> 1); else return cout << "NOT UNIQUE\n", 0; } } if (!ans.empty()) cout << ans; else cout << "NOT POSSIBLE\n"; return 0; }

Compilation message (stderr)

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