Submission #931241

# Submission time Handle Problem Language Result Execution time Memory
931241 2024-02-21T12:28:30 Z PlayVoltz Three Friends (BOI14_friends) C++17
0 / 100
500 ms 6876 KB
#include <iostream>
#include <map>
#include <vector>
#include <climits>
#include <stack>
#include <string>
#include <queue>
#include <algorithm>
#include <set>
#include <unordered_set>
#include <iostream>
#include <unordered_map>
#include <cmath>
#include <cctype>
#include <bitset>
#include <iomanip>
#include <cstring>
using namespace std;

#define int long long
#define pii pair<int, int>
#define mp make_pair
#define pb push_back
#define fi first
#define se second

int32_t main(){
	int n;
	string s, a="", b="";
	cin>>n>>s;
	for (int i=0; i<n/2; ++i)a+=s[i];
	for (int i=n-1; i>n-n/2-1; --i)b=s[i]+b;
	bool one=1, can=1, can2=1;
	int p=0;
	for (int i=0; i<1+(n-1)/2; ++i){
		if (b[p]==s[i])++p;
		else if (one)one=0;
		else {can=0;break;}
	}
	one=1;
	p=0;
	for (int i=n/2; i<n; ++i){
		if (a[p]==s[i])++p;
		else if (one)one=0;
		else {can2=0;break;}
	}
	if (can&&can2)cout<<"NOT UNIQUE";
	else if (can)cout<<b;
	else if (can2)cout<<a;
	else cout<<"NOT POSSIBLE";
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Incorrect 0 ms 348 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1061 ms 6876 KB Time limit exceeded
2 Halted 0 ms 0 KB -