Submission #60735502
Source Code Expand
Copy
#include<bits/stdc++.h>using namespace std;typedef long long ll;const ll mod = 998244353;const int maxn = 2e5 + 7;const double PI = acos(-1), eps = 1e-7;int a[10];struct node {string s;int cnt;};vector<node> v;bool cmp(node l1, node l2) {if (l1.cnt == l2.cnt)return l1.s < l2.s;return l1.cnt > l2.cnt;}
#include<bits/stdc++.h> using namespace std; typedef long long ll; const ll mod = 998244353; const int maxn = 2e5 + 7; const double PI = acos(-1), eps = 1e-7; int a[10]; struct node { string s; int cnt; }; vector<node> v; bool cmp(node l1, node l2) { if (l1.cnt == l2.cnt) return l1.s < l2.s; return l1.cnt > l2.cnt; } void dfs(int idx, int m, int cnt, string s) { if (m != 0) v.push_back({s, cnt}); if (m == 5) return; for (int i = idx; i <= 5; i++) { dfs(i + 1, m + 1, cnt + a[i], s + char('A' + i - 1)); } } void solve() { for (int i = 1; i <= 5; i++) { cin >> a[i]; } dfs(1, 0, 0, ""); sort(v.begin(), v.end(), cmp); for (auto i: v) { cout << i.s << '\n'; } } int main() { std::ios::sync_with_stdio(false), cin.tie(0), cout.tie(0); int T = 1; // cin >> T; while (T--) { solve(); } return 0; }
Submission Info
Submission Time | |
---|---|
Task | C - Perfect Standings |
User | 2021404292 |
Language | C++ 20 (gcc 12.2) |
Score | 300 |
Code Size | 991 Byte |
Status | AC |
Exec Time | 1 ms |
Memory | 3572 KB |
Judge Result
Set Name | Sample | All | ||||
---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 300 / 300 | ||||
Status |
|
|
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 | 3508 KB |
00_sample_01.txt | AC | 1 ms | 3496 KB |
00_sample_02.txt | AC | 1 ms | 3500 KB |
01_random_03.txt | AC | 1 ms | 3432 KB |
01_random_04.txt | AC | 1 ms | 3508 KB |
01_random_05.txt | AC | 1 ms | 3360 KB |
01_random_06.txt | AC | 1 ms | 3496 KB |
01_random_07.txt | AC | 1 ms | 3500 KB |
01_random_08.txt | AC | 1 ms | 3500 KB |
01_random_09.txt | AC | 1 ms | 3432 KB |
01_random_10.txt | AC | 1 ms | 3488 KB |
01_random_11.txt | AC | 1 ms | 3504 KB |
01_random_12.txt | AC | 1 ms | 3476 KB |
01_random_13.txt | AC | 1 ms | 3572 KB |
01_random_14.txt | AC | 1 ms | 3496 KB |
01_random_15.txt | AC | 1 ms | 3432 KB |
01_random_16.txt | AC | 1 ms | 3508 KB |
01_random_17.txt | AC | 1 ms | 3488 KB |
01_random_18.txt | AC | 1 ms | 3480 KB |
01_random_19.txt | AC | 1 ms | 3504 KB |
01_random_20.txt | AC | 1 ms | 3476 KB |
01_random_21.txt | AC | 1 ms | 3428 KB |
01_random_22.txt | AC | 1 ms | 3568 KB |
01_random_23.txt | AC | 1 ms | 3504 KB |
01_random_24.txt | AC | 1 ms | 3368 KB |
01_random_25.txt | AC | 1 ms | 3368 KB |
01_random_26.txt | AC | 1 ms | 3368 KB |
01_random_27.txt | AC | 1 ms | 3432 KB |
01_random_28.txt | AC | 1 ms | 3508 KB |
01_random_29.txt | AC | 1 ms | 3480 KB |
01_random_30.txt | AC | 1 ms | 3436 KB |
01_random_31.txt | AC | 1 ms | 3508 KB |
01_random_32.txt | AC | 1 ms | 3444 KB |
01_random_33.txt | AC | 1 ms | 3420 KB |