Submission #60728914


Source Code Expand

Copy
#include<bits/stdc++.h>
using namespace std;
int a[5];
pair<int, string> p[32];
int main() {
cin >> a[0] >> a[1] >> a[2] >> a[3] >> a[4];
for (int i = 0; i < (1 << 5); i++) {
string s = "";
int val = 0;
for (int j = 0; j < 5; j++) {
if ((i >> j) & 1) {
s += 'A' + j;
val += a[j];
}
}
p[i] = {val, s};
}
sort(p, p + 32, [](pair<int, string> x, pair<int, string> y) {
if (x.first != y.first) return x.first > y.first;
return x.second + y.second < y.second + x.second;
});
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
#include<bits/stdc++.h>
using namespace std;
int a[5];
pair<int, string> p[32];
int main() {
    cin >> a[0] >> a[1] >> a[2] >> a[3] >> a[4];
    for (int i = 0; i < (1 << 5); i++) {
        string s = "";
        int val = 0;
        for (int j = 0; j < 5; j++) {
            if ((i >> j) & 1) {
                s += 'A' + j;
                val += a[j];
            }
        }
        p[i] = {val, s};
    }
    sort(p, p + 32, [](pair<int, string> x, pair<int, string> y) {
        if (x.first != y.first) return x.first > y.first;
        return x.second + y.second < y.second + x.second;
    });
    for (int i = 0; i < 31; i++) {
        cout << p[i].second << endl;
    }
    return 0;
}

Submission Info

Submission Time
Task C - Perfect Standings
User Tianyiwei
Language C++ 20 (gcc 12.2)
Score 300
Code Size 720 Byte
Status AC
Exec Time 1 ms
Memory 3648 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 300 / 300
Status
AC × 3
AC × 34
Set Name Test Cases
Sample 00_sample_00.txt, 00_sample_01.txt, 00_sample_02.txt
All 00_sample_00.txt, 00_sample_01.txt, 00_sample_02.txt, 01_random_03.txt, 01_random_04.txt, 01_random_05.txt, 01_random_06.txt, 01_random_07.txt, 01_random_08.txt, 01_random_09.txt, 01_random_10.txt, 01_random_11.txt, 01_random_12.txt, 01_random_13.txt, 01_random_14.txt, 01_random_15.txt, 01_random_16.txt, 01_random_17.txt, 01_random_18.txt, 01_random_19.txt, 01_random_20.txt, 01_random_21.txt, 01_random_22.txt, 01_random_23.txt, 01_random_24.txt, 01_random_25.txt, 01_random_26.txt, 01_random_27.txt, 01_random_28.txt, 01_random_29.txt, 01_random_30.txt, 01_random_31.txt, 01_random_32.txt, 01_random_33.txt
Case Name Status Exec Time Memory
00_sample_00.txt AC 1 ms 3488 KB
00_sample_01.txt AC 1 ms 3468 KB
00_sample_02.txt AC 1 ms 3460 KB
01_random_03.txt AC 1 ms 3648 KB
01_random_04.txt AC 1 ms 3524 KB
01_random_05.txt AC 1 ms 3424 KB
01_random_06.txt AC 1 ms 3492 KB
01_random_07.txt AC 1 ms 3488 KB
01_random_08.txt AC 1 ms 3524 KB
01_random_09.txt AC 1 ms 3360 KB
01_random_10.txt AC 1 ms 3428 KB
01_random_11.txt AC 1 ms 3648 KB
01_random_12.txt AC 1 ms 3532 KB
01_random_13.txt AC 1 ms 3464 KB
01_random_14.txt AC 1 ms 3648 KB
01_random_15.txt AC 1 ms 3452 KB
01_random_16.txt AC 1 ms 3392 KB
01_random_17.txt AC 1 ms 3560 KB
01_random_18.txt AC 1 ms 3492 KB
01_random_19.txt AC 1 ms 3440 KB
01_random_20.txt AC 1 ms 3456 KB
01_random_21.txt AC 1 ms 3568 KB
01_random_22.txt AC 1 ms 3464 KB
01_random_23.txt AC 1 ms 3432 KB
01_random_24.txt AC 1 ms 3496 KB
01_random_25.txt AC 1 ms 3440 KB
01_random_26.txt AC 1 ms 3648 KB
01_random_27.txt AC 1 ms 3440 KB
01_random_28.txt AC 1 ms 3460 KB
01_random_29.txt AC 1 ms 3484 KB
01_random_30.txt AC 1 ms 3492 KB
01_random_31.txt AC 1 ms 3452 KB
01_random_32.txt AC 1 ms 3648 KB
01_random_33.txt AC 1 ms 3492 KB


2025-03-05 (Wed)
18:06:08 +00:00