Task: | Tulostaulu |
Sender: | zli0122 |
Submission time: | 2025-01-18 13:56:51 +0200 |
Language: | C++ (C++17) |
Status: | READY |
Result: | 100 |
group | verdict | score |
---|---|---|
#1 | ACCEPTED | 20 |
#2 | ACCEPTED | 20 |
#3 | ACCEPTED | 60 |
test | verdict | time | group | |
---|---|---|---|---|
#1 | ACCEPTED | 0.00 s | 1, 3 | details |
#2 | ACCEPTED | 0.01 s | 2, 3 | details |
#3 | ACCEPTED | 0.01 s | 3 | details |
#4 | ACCEPTED | 0.00 s | 1, 2, 3 | details |
#5 | ACCEPTED | 0.01 s | 3 | details |
#6 | ACCEPTED | 0.01 s | 3 | details |
Compiler report
input/code.cpp: In function 'void solve()': input/code.cpp:50:29: warning: array subscript has type 'char' [-Wchar-subscripts] 50 | if (contestants[id][problem] < value) { | ^~~~~~~ input/code.cpp:52:29: warning: array subscript has type 'char' [-Wchar-subscripts] 52 | contestants[id][problem] = value; | ^~~~~~~
Code
#include <bits/stdc++.h> using namespace std; //#define int long long typedef vector<int> vi; typedef pair<int, int> pi; #define fi first #define se second #define pb push_back #define MOD 1000000007 #define INF LLONG_MAX/2-1 #define N 110 int contestants[N][10] = {0}; int prio[N] = {0}; string uncmprs[N]; bool comp(pi a, pi b) { if (a.fi == 0 && b.fi==0) { return (uncmprs[a.se] < uncmprs[b.se]);} if (a.fi == b.fi) return (prio[a.se] < prio[b.se]); return (a.fi>b.fi); } void solve() { int n, m, k; cin >> n >> m >> k; map<string, int> cmprs; for (int i = 0; i<n; i++) { string s; cin >> s; cmprs[s] = i; uncmprs[i] = s; } for (int i = 0; i<m; i++) { string s; char problem; int value; cin >> s >> problem >> value; problem = problem - 'A'; int id = cmprs[s]; if (contestants[id][problem] < value) { prio[id] = i; contestants[id][problem] = value; } } vector<pi> order; for (int i = 0; i<n; i++) { int s = 0; for (int p=0;p<10;p++) s+=contestants[i][p]; order.pb({s, i}); } sort(order.begin(), order.end(), comp); for (auto i : order) { cout << uncmprs[i.se] << " " << i.fi << "\n"; } } signed main() { cin.tie(0) -> ios::sync_with_stdio(0); solve(); } /* if contestants[s[0]][p_num] < int(s[2]): prio[s[0]] = i contestants[s[0]][p_num] = int(s[2]) def comp(a, b): return a > b points = for i in contestants: for i in contestants: print(i) print(prio)*/
Test details
Test 1
Group: 1, 3
Verdict: ACCEPTED
input |
---|
1 5000 10 zsyad zsyad J 14 zsyad A 40 zsyad D 34 ... |
correct output |
---|
zsyad 1000 |
user output |
---|
zsyad 1000 |
Test 2
Group: 2, 3
Verdict: ACCEPTED
input |
---|
100 5000 1 eayoy mkiie sqd mgq ... |
correct output |
---|
ujogxx 100 dadxy 100 ttldevgm 100 awbj 100 j 100 ... |
user output |
---|
ujogxx 100 dadxy 100 ttldevgm 100 awbj 100 j 100 ... Truncated |
Test 3
Group: 3
Verdict: ACCEPTED
input |
---|
100 5000 10 bsvhdn xlxadb gbc sadll ... |
correct output |
---|
ezgermxsii 927 urclsrvlq 924 shgvs 919 xwkqtroxqr 918 oovi 893 ... |
user output |
---|
ezgermxsii 927 urclsrvlq 924 shgvs 919 xwkqtroxqr 918 oovi 893 ... Truncated |
Test 4
Group: 1, 2, 3
Verdict: ACCEPTED
input |
---|
1 0 1 xoezwspspf |
correct output |
---|
xoezwspspf 0 |
user output |
---|
xoezwspspf 0 |
Test 5
Group: 3
Verdict: ACCEPTED
input |
---|
100 5000 10 bwv jxz cpktj mhzevc ... |
correct output |
---|
afvgeut 0 ai 0 amfrsvuqao 0 beadkfbr 0 bkgztu 0 ... |
user output |
---|
afvgeut 0 ai 0 amfrsvuqao 0 beadkfbr 0 bkgztu 0 ... Truncated |
Test 6
Group: 3
Verdict: ACCEPTED
input |
---|
100 5000 10 yifvbbjcz cnpkni qvltt ngpe ... |
correct output |
---|
vgyo 10 msgagpngrd 10 cnpkni 10 lpwlq 10 qguwtubeqi 10 ... |
user output |
---|
vgyo 10 msgagpngrd 10 cnpkni 10 lpwlq 10 qguwtubeqi 10 ... Truncated |