Submission #1228701

#TimeUsernameProblemLanguageResultExecution timeMemory
1228701guessi세 명의 친구들 (BOI14_friends)C++20
35 / 100
1093 ms8184 KiB
#include <bits/stdc++.h>
using namespace std;

#define int long long

int32_t main () {
    int n; cin >> n;
    string u, aux3 = ""; cin >> u;
    int resp = 0;
    
    if(n%2 == 0) {
        cout << "NOT POSSIBLE";
        return 0;
    }
    
    for(int i = 0; i < n; i++) {
        string aux = "";
        for(int j = 0; j < n; j++) {
            if(j == i) continue;
            
            aux += u[j];
        }
        
        string aux2 = "";
        
        for(int k = 0; k < (n-1)/2; k++) {
            if(aux[k] == aux[k+(n-1)/2]) aux2 += aux[k];
        }
        
        if(aux2.size() == (n-1)/2) {
            if(aux2 != aux3) resp++;
            
            aux3 = aux2;
        }
    
    }
    
    if(resp > 1) cout << "NOT UNIQUE";
    else if(aux3 == "") cout << "NOT POSSIBLE";
    else cout << aux3;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...