CSES - Datatähti 2025 loppu - Results
Submission details
Task:Tulostaulu
Sender:NoelMatero
Submission time:2025-01-18 14:59:57 +0200
Language:C++ (C++17)
Status:READY
Result:20
Feedback
groupverdictscore
#1ACCEPTED20
#20
#30
Test results
testverdicttimegroup
#1ACCEPTED0.01 s1, 3details
#20.01 s2, 3details
#30.01 s3details
#4ACCEPTED0.00 s1, 2, 3details
#50.01 s3details
#60.01 s3details

Code

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

int main() {
    //freopen("test.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);

    int n, m, k; cin >> n >> m >> k;

    vector<string> names(n);
    map<string, int> b;


    for (int i=0;i<n;i++) {
        cin >> names[i];
    } 

    map<char, int> a;
    vector<char> chars = {'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J'};
    for (int i=0;i<k;i++) a[chars[i]] = i;
    for (int i=0;i<n;i++) {
        b[names[i]] = i;
    } 

    int ans[n][k];

    for (string name : names) {
        for (char c : chars) {
            ans[b[name]][a[c]] = 0;
        }
    }

    for(int i=0;i<m;i++) {
        string name; char task; int score;

        cin >> name >> task >> score;

        if (ans[b[name]][a[task]] != 0) {
            ans[b[name]][a[task]] = max(ans[b[name]][a[task]], score);
        } else if (ans[b[name]][a[task]]==0) {
            ans[b[name]][a[task]] = score;
        } 
    }

    vector<pair<int, string>> pls_toimi;
    for (string name : names) {
        ll tmp = 0;
        for (int i=0;i<k;i++) {
            tmp += ans[b[name]][a[chars[i]]];
        }

        pls_toimi.push_back(make_pair(tmp, name));
        //cout << name << " " << tmp << endl;
    }

    (sort(pls_toimi.begin(), pls_toimi.end()));

    for (int i=n-1;i>=0;i--) {
        cout << pls_toimi[i].second << " " << pls_toimi[i].first << endl; 
    }
    /*for (string name : names) {
        int s = 0;
        for (int i=0;i<k;i++) {
            cout << ans[b[name]][i] << endl;
        }
    }*/

}

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:

input
100 5000 1
eayoy
mkiie
sqd
mgq
...

correct output
ujogxx 100
dadxy 100
ttldevgm 100
awbj 100
j 100
...

user output
yruffkwq 100
yem 100
y 100
wvhzdb 100
weczn 100
...
Truncated

Test 3

Group: 3

Verdict:

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:

input
100 5000 10
bwv
jxz
cpktj
mhzevc
...

correct output
afvgeut 0
ai 0
amfrsvuqao 0
beadkfbr 0
bkgztu 0
...

user output
zunam 0
zp 0
zeaqfylgx 0
zd 0
zagsurwfxs 0
...
Truncated

Test 6

Group: 3

Verdict:

input
100 5000 10
yifvbbjcz
cnpkni
qvltt
ngpe
...

correct output
vgyo 10
msgagpngrd 10
cnpkni 10
lpwlq 10
qguwtubeqi 10
...

user output
zujlfqz 10
yprlgohlqg 10
ynbccwtb 10
yifvbbjcz 10
yhh 10
...
Truncated