92242024-02-18 19:12:50xxxVáltakozó (75 pont)cpp14Wrong answer 6/753ms4488 KiB
#include <bits/stdc++.h>

using namespace std;

#define int long long

signed main() {
    cout << -1 << endl;;
    return 0;
    string s;
    cin >> s;
    int n = s.length();
    int nc = n;

    int chars[26] = {0};

    for(int i = 0; i < n; i++) {
        chars[s[i]-'a']++;
    }

    for(int i = 0; i < 26; i++) {
        if (chars[i] > n/2) {
            cout << -1 << endl;
            return 0;
        }
    }
    int jochar = -1, elozo = -2;

    for(int i = 0; i < n; i++) {
        for(int j = 25; j >= 0; j--) {
            if (chars[j] <= 0 || elozo == j) {
                continue;
            }
            if (chars[j] > nc/2) {
                jochar = j;
                j = -10;
            } else {
                jochar = j;
            }
        }
        
        
        cout << (char)(jochar+'a');
        //cout << nc << ' ';
        nc--;
        chars[jochar]--;
        elozo = jochar;
    }

    return 0;    
}
SubtaskSumTestVerdictTimeMemory
base6/75
1Wrong answer0/03ms1868 KiB
2Wrong answer0/03ms2120 KiB
3Wrong answer0/32ms2140 KiB
4Wrong answer0/33ms2272 KiB
5Wrong answer0/33ms2528 KiB
6Wrong answer0/33ms2736 KiB
7Wrong answer0/33ms2808 KiB
8Wrong answer0/33ms2908 KiB
9Accepted3/33ms3016 KiB
10Accepted3/33ms3248 KiB
11Wrong answer0/33ms3508 KiB
12Wrong answer0/33ms3656 KiB
13Wrong answer0/33ms3856 KiB
14Wrong answer0/32ms3948 KiB
15Wrong answer0/33ms3948 KiB
16Wrong answer0/33ms3940 KiB
17Wrong answer0/33ms4068 KiB
18Wrong answer0/33ms4068 KiB
19Wrong answer0/33ms4280 KiB
20Wrong answer0/33ms4364 KiB
21Wrong answer0/33ms4368 KiB
22Wrong answer0/63ms4372 KiB
23Wrong answer0/63ms4484 KiB
24Wrong answer0/63ms4488 KiB