CSES - Datatähti 2025 loppu - Results
Submission details
Task:Tulostaulu
Sender:Touko_Ursin
Submission time:2025-01-18 13:45:56 +0200
Language:C++ (C++20)
Status:READY
Result:0
Feedback
groupverdictscore
#10
#20
#30
Test results
testverdicttimegroup
#10.40 s1, 3details
#20.40 s2, 3details
#30.40 s3details
#40.40 s1, 2, 3details
#50.40 s3details
#60.40 s3details

Compiler report

input/code.cpp: In function 'int main()':
input/code.cpp:6:12: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
    6 |     freopen("input.txt", "r", stdin);
      |     ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
input/code.cpp:7:12: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
    7 |     freopen("output.txt", "w", stdout);
      |     ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~

Code

#include <bits/stdc++.h>

using namespace std;

int main(){
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    int n, m, k;
    cin>>n>>m>>k;

    unordered_map<string, int> kilpailijat;
    vector<string> nimet;
    vector<int> lastupdate;
    lastupdate.resize(n, 0);
    string x;
    for(int i = 0; i<n; i++){
        cin>>x;
        kilpailijat.insert({x, i});
        nimet.push_back(x);
    }
    vector<vector<int>> teht;
    teht.resize(n);
    for(int i = 0; i<n; i++){
        for(int j = 0; j<m; j++){
            teht[i].push_back(0);
        }
    }
    char s;
    int score;
    for(int i = 0; i<m; i++){
        cin>>x;
        cin>>s;
        cin>>score;
    

        if(score > teht[kilpailijat[x]][s-'A']){
            lastupdate[kilpailijat[x]] = m;
            teht[kilpailijat[x]][s-'A'] = max(score, teht[kilpailijat[x]][s-'A']);
        }
    }


    vector<pair<pair<int,int>,string>> tulokset;

    for(int i = 0; i<n; i++){
        int final=0;
        for(int num: teht[i]){
            final=final+num;
        }
        tulokset.push_back({{final*-1, lastupdate[i]}, nimet[i]});
    }
    sort(tulokset.begin(), tulokset.end());

    for(auto line: tulokset){
        cout<<line.second<<" "<<line.first.first*-1<<"\n";
    }

    

}

Test details

Test 1

Group: 1, 3

Verdict:

input
1 5000 10
zsyad
zsyad J 14
zsyad A 40
zsyad D 34
...

correct output
zsyad 1000

user output
(empty)

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
(empty)

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
(empty)

Test 4

Group: 1, 2, 3

Verdict:

input
1 0 1
xoezwspspf

correct output
xoezwspspf 0

user output
(empty)

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
(empty)

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
(empty)