제출 #398567

#제출 시각아이디문제언어결과실행 시간메모리
398567iulia13세 명의 친구들 (BOI14_friends)C++14
0 / 100
91 ms5192 KiB
#include <iostream> using namespace std; const int nmax = 2e6 + 5; char v[nmax]; int main() { int n, i = 1, j = 1, ok = 0; cin >> n; if (n % 2 == 0) { cout << "NOT POSSIBLE"; return 0; } cin >> v + 1; int skip = 0; ///primele n / 2 sunt suuuper for (i = n / 2 + 1; i <= n && skip < 2 && j <= n / 2; i++) { if (v[i] == v[j]) j++; else skip++; } if (skip < 2) ok = 1; skip = 0; j = n / 2 + 2; ///ult n / 2 sunt suuuuuuuuuper for (i = 1; i <= n / 2 + 1 && j <= n && skip < 2; i++) { if (v[i] == v[j]) j++; else skip++; } if (skip < 2) ok += 2; if (ok == 3) { cout << "NOT UNIQUE"; return 0; } if (!ok) { cout << "NOT POSSIBLE"; return 0; } if (ok == 1) { for (i = 1; i <= n/ 2; i++) cout << v[i]; } else { for (i = n / 2 + 2; i <= n; i++) cout << v[i]; } return 0; }

컴파일 시 표준 에러 (stderr) 메시지

friends.cpp: In function 'int main()':
friends.cpp:15:14: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
   15 |     cin >> v + 1;
      |            ~~^~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...