| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 958851 | Pring | Three Friends (BOI14_friends) | C++17 | 8 ms | 9076 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
#ifdef MIKU
string dbmc = "\033[1;38;2;57;197;187m", dbrs = "\033[0m";
#define debug(x...) cout << dbmc << "[" << #x << "]: ", dout(x)
void dout() { cout << dbrs << endl; }
template <typename T, typename ...U>
void dout(T t, U ...u) { cout << t << (sizeof...(u) ? ", " : ""); dout(u...); }
#else
#define debug(...) 39
#endif
#define int long long
#define fs first
#define sc second
#define mp make_pair
#define FOR(i, j, k) for (int i = j, Z = k; i < Z; i++)
typedef pair<int, int> pii;
int n;
string s;
string ans[2];
bitset<2> b;
void SOLVE(int id, string l, string r) {
int x = 0;
for (auto &i : r) {
if (x < l.size() && i == l[x]) x++;
}
if (x == l.size()) {
b[id] = 1;
ans[id] = l;
return;
}
b[id] = 0;
}
void miku() {
cin >> n >> s;
if (n % 2 == 0) {
cout << "NOT POSSIBLE" << '\n';
return;
}
SOLVE(0, s.substr(0, n / 2), s.substr(n / 2, n - n / 2));
SOLVE(1, s.substr(n / 2 + 1, n - n / 2 - 1), s.substr(0, n / 2 + 1));
if (!b[0] && !b[1]) {
cout << "NOT POSSIBLE" << '\n';
return;
}
if (b[0] && b[1]) {
cout << (ans[0] == ans[1] ? ans[0] : "NOT UNIQUE") << '\n';
return;
}
cout << (b[0] ? ans[0] : ans[1]) << '\n';
}
int32_t main() {
cin.tie(0) -> sync_with_stdio(false);
cin.exceptions(cin.failbit);
miku();
return 0;
}
컴파일 시 표준 에러 (stderr) 메시지
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
