| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 484281 | MohamedAhmed04 | Three Friends (BOI14_friends) | C++14 | 8 ms | 6256 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std ;
const int MAX = 2e6 + 10 ;
int arr[MAX] ;
int n ;
string s ;
bool check(string s2 , int l , int r)
{
int idx = 0 ;
int rem = 1 ;
for(int i = l ; i <= r && idx < s2.size() ; ++i)
{
if(s[i] == s2[idx])
++idx ;
else
rem-- ;
}
return (idx == s2.size() && rem >= 0) ;
}
int main()
{
ios_base::sync_with_stdio(0) ;
cin.tie(0) ;
cin>>n ;
cin>>s ;
bool flag1 = check(s.substr(0 , n/2) , n/2 , n-1) ;
bool flag2 = check(s.substr(n-n/2 , n/2) , 0 , n/2) ;
if(!flag1 && !flag2)
cout<<"NOT POSSIBLE\n" ;
else if(flag1 && flag2 && s.substr(0 , n/2) != s.substr(n-n/2 , n/2))
cout<<"NOT UNIQUE\n" ;
else if(flag1)
cout<<s.substr(0 , n/2)<<"\n" ;
else
cout<<s.substr(n-n/2 , n/2) ;
return 0 ;
}
컴파일 시 표준 에러 (stderr) 메시지
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
