238742026-01-31 11:30:33BoldizsárVetélkedő (75 pont)cpp17Wrong answer 5/75109ms7476 KiB
// Source: https://usaco.guide/general/io

#include <bits/stdc++.h>
using namespace std;

int main() {
    int n;cin >> n;
    vector<string>teamss(n);
    vector<string>teams(n);
    int cnt = 0;string melyik;
    for(int i = 0;i < n;i++){
        string s;cin >>s;
        string sb = s;
        sort(sb.begin(),sb.end());
        teamss[i] = sb;
        teams[i] = s;
    } 
    sort(teamss.begin(),teamss.end());
    string before = "";
    for(int i = 0;i < n;i++){
        if(teamss[i] == before) cnt++;
        else{
            if(cnt % 2 == 0) melyik =  teamss[i];
            cnt = 1;
            before = teamss[i];
        }
    }
    vector<string>kell;
    for(int i = 0;i < n;i++){
        string temp = teams[i];
        sort(temp.begin(),temp.end());
        if( temp == melyik){
            kell.push_back(teams[i]);
        }
    }
    sort(kell.begin(),kell.end());
    vector<char>s;
    for(int i = 0;i < melyik.size();i++){
        s.push_back(char(melyik[i]));
    }
    for(int i = 0;i < kell.size();i++){
        string ss = "";
        for(int j = 0;j <s.size();j++) ss = ss + s[j];
        if( ss!=kell[i]) break;
        next_permutation(s.begin(),s.end());
    }
    for(int i =0;i < s.size();i++) cout << s[i];
}

/*

sorba rendezed az osszes ilyen szot: sorba

vector <char> s; sorba rendezve tartalmazza a karaktereket

for (int i = 0; i<sorba.size();i++){

    if (s != sorba[i]) break; <- egyenloseg nem mukodik
    next_permutation(s.begin(),s.end());
}

*/
SubtaskSumTestVerdictTimeMemory
base5/75
1Accepted0/01ms508 KiB
2Wrong answer0/0108ms6452 KiB
3Wrong answer0/51ms316 KiB
4Wrong answer0/51ms500 KiB
5Accepted5/51ms316 KiB
6Wrong answer0/51ms316 KiB
7Wrong answer0/52ms416 KiB
8Wrong answer0/52ms476 KiB
9Wrong answer0/53ms316 KiB
10Wrong answer0/554ms3560 KiB
11Wrong answer0/564ms4780 KiB
12Wrong answer0/575ms5292 KiB
13Wrong answer0/586ms6176 KiB
14Wrong answer0/597ms6732 KiB
15Wrong answer0/5109ms6716 KiB
16Wrong answer0/5107ms7476 KiB
17Wrong answer0/598ms6920 KiB