제출 #42963

#제출 시각아이디문제언어결과실행 시간메모리
42963BThero세 명의 친구들 (BOI14_friends)C++14
0 / 100
11 ms6700 KiB
#include <assert.h> #include <stdio.h> #define pb push_back #define mp make_pair #define fi first #define se second typedef long long ll; using namespace std; char s[2000005]; int n, ans; void solve() { scanf("%d", &n); scanf("%s", s); if (n % 2 == 0) { printf("NOT POSSIBLE\n"); return; } assert(n <= 2001); int len = (n - 1) / 2; ans = -1; for (int i = 0; i < n; ++i) { int l = 0, r = len; if (i == 0) { ++l; } if (i <= r) { ++r; } bool ok = 1; while (r < n) { if (s[l] != s[r]) { ok = 0; } if (++l == i) { ++l; } if (++r == i) { ++r; } } if (ok) { if (ans != -1) { printf("NOT UNIQUE\n"); return; } ans = i; } } for (int i = 0, cnt = 0; cnt < len; ++i) { if (i == ans) { continue; } printf("%c", s[i]); ++cnt; } } int main() { int tt = 1; while (tt--) { solve(); } return 0; }

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

friends.cpp: In function 'void solve()':
friends.cpp:19:20: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d", &n);
                    ^
friends.cpp:20:19: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%s", s);
                   ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...