| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 46215 | arman_ferdous | 세 명의 친구들 (BOI14_friends) | C++11 | 24 ms | 10556 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
int n;
string s;
set<string> st;
// search for [l2,r2] in [l1,r1] with exactly one mismatch and skip it
bool match_and_skip(int l1, int r1, int l2, int r2) {
int cnt = 0;
string ret = "";
while(l1 <= r1 && l2 <= r2) {
if(s[l1] != s[l2]) cnt++, l2--;
else ret += s[l1];
if(cnt > 1) return false;
l1++, l2++;
}
if(cnt == 1 || (l1 <= r1 && cnt == 0)) st.insert(ret);
}
int main() {
ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
cin >> n >> s;
if(~n&1) { cout << "NOT POSSIBLE\n"; return 0; }
int len = n>>1;
match_and_skip(0,len,len+1,n-1); // (.x..)(...)
match_and_skip(len,n-1,0,len-1); // (...)(..x.)
if(st.size() == 0) cout << "NOT POSSIBLE\n";
else if(st.size() > 1) cout << "NOT UNIQUE\n";
else cout << *(st.begin()) << "\n";
return 0;
}컴파일 시 표준 에러 (stderr) 메시지
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
