# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
625627 | 2022-08-10T16:10:57 Z | kkkkkkkk | 세 명의 친구들 (BOI14_friends) | C++14 | 81 ms | 4228 KB |
#include <iostream> using namespace std; int main() { int n; string s; cin >> n >> s; if (n%2==0) { cout << "NOT POSSIBLE" << endl; return 0; } int cnt=0,poz=-1; bool ok=true,moze=true; for (int i=0,j=n/2+1;j<n,i<=n/2;) { if (s[i]==s[j]) i++,j++; else if (s[i]!=s[j]&&ok==true) poz=i,i++,ok=false; else { moze=false; break; } } if (moze) cnt++; ok=true,moze=true; for (int i=0,j=n/2;j<n,i<n/2;) { if (s[i]==s[j]) i++,j++; else if (s[i]!=s[j]&&ok==true) { if (poz==-1) poz=j; j++,ok=false; } else { moze=false; break; } } if (moze) cnt++; if (cnt==0) cout << "NOT POSSIBLE" << endl; else if (cnt==1) { //cout << poz << endl; if (poz>=n/2) { for (int i=0;i<n/2;i++) cout << s[i]; } else { for (int i=n/2+1;i<n;i++) cout << s[i]; } } else cout << "NOT UNIQUE" << endl; return 0; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 212 KB | Output is correct |
2 | Correct | 0 ms | 212 KB | Output is correct |
3 | Correct | 0 ms | 212 KB | Output is correct |
4 | Incorrect | 0 ms | 212 KB | Output isn't correct |
5 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 76 ms | 4228 KB | Output is correct |
2 | Correct | 81 ms | 4216 KB | Output is correct |
3 | Correct | 73 ms | 4208 KB | Output is correct |
4 | Correct | 75 ms | 4212 KB | Output is correct |
5 | Correct | 78 ms | 4184 KB | Output is correct |
6 | Correct | 48 ms | 4172 KB | Output is correct |
7 | Incorrect | 46 ms | 4184 KB | Output isn't correct |
8 | Halted | 0 ms | 0 KB | - |