# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
943337 | 2024-03-11T11:04:27 Z | Darren0724 | 세 명의 친구들 (BOI14_friends) | C++17 | 7 ms | 5340 KB |
#include <bits/stdc++.h> using namespace std; #define LCBorz ios_base::sync_with_stdio(false); cin.tie(0); #define all(x) x.begin(), x.end() #define endl '\n' const int N=200005; const int INF=1e9; string cmp(string a,string b){ if(a.size()>b.size())swap(a,b); int bad=0; int j=0; int n=a.size(); for(int i=0;i<n;i++){ while(j<b.size()&&a[i]!=b[j]){ bad++; j++; } j++; } return (bad<=1?a:""); } int32_t main() { LCBorz; int n;cin>>n; string s;cin>>s; string a=cmp(s.substr(0,n/2),s.substr(n/2,n-n/2)); string b=cmp(s.substr(0,n/2+1),s.substr(n/2+1,n-n/2)); if(n%2==0||(a.size()==0&&b.size()==0)){ cout<<"NOT POSSIBLE"<<endl; return 0; } if(a!=b){ cout<<"NOT UNIQUE"<<endl; return 0; } cout<<(a.size()?a:b)<<endl; return 0; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 348 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 7 ms | 5340 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |