| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 42965 | BThero | Three Friends (BOI14_friends) | C++14 | 11 ms | 4588 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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];
char t[2000005];
int n, ans;
int sz;
void solve() {
scanf("%d", &n);
scanf("%s", s);
if (n % 2 == 0) {
printf("NOT POSSIBLE\n");
return;
}
assert(n <= 5000);
int len = (n - 1) / 2;
ans = -1;
for (int i = 0; i < n; ++i) {
sz = 0;
for (int j = 0; j < n; ++j) {
if (j != i) {
t[sz++] = s[j];
}
}
bool ok = 1;
for (int j = 0; j < len; ++j) {
if (t[j] != t[j + len]) {
ok = 0;
}
}
if (ok) {
if (ans != -1) {
printf("NOT UNIQUE\n");
return;
}
ans = i;
}
}
if (ans == -1) {
printf("NOT POSSIBLE\n");
return;
}
for (int i = 0, cnt = 0; cnt < len; ++i) {
if (i == ans) {
continue;
}
printf("%c", s[i]);
++cnt;
}
}
int main() {
#ifdef BThero
freopen("input.txt", "r", stdin);
freopen("output.txt", "w", stdout);
#endif // BThero
int tt = 1;
while (tt--) {
solve();
}
return 0;
}
컴파일 시 표준 에러 (stderr) 메시지
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
