Submission #711627

# Submission time Handle Problem Language Result Execution time Memory
711627 2023-03-17T10:02:49 Z minipig ACM (COCI19_acm) C++14
50 / 50
2 ms 340 KB
#include <bits/stdc++.h>
using namespace std;

struct score{
    int AC=0,penalty=0;
    string name;
    const bool operator <(score team2) const{
        if(AC!=team2.AC){
            return AC<team2.AC;
        }
        if(penalty!=team2.penalty){
            return penalty>team2.penalty;
        }
        return name<team2.name;
    }
} score1;

set<score> set1;

int main(){
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int n,m;
    cin>>n>>m;
    for(int i=0;i<=n;i++){
        string team_name;
        cin>>team_name;
        int temp_AC=0,temp_penalty=0;
        for(int j=0;j<m;j++){
            string temp_score;
            cin>>temp_score;
            if(temp_score[0]=='-'||(team_name=="NijeZivotJedanACM"&&i!=n)){
                continue;
            }
            else{
                temp_AC++;
                temp_penalty+=(temp_score[1]-'0'-1)*20*60;
                int H,M,S;
                H=(temp_score[3]-'0')*10+(temp_score[4]-'0');
                M=(temp_score[6]-'0')*10+(temp_score[7]-'0');
                S=(temp_score[9]-'0')*10+(temp_score[10]-'0');
                temp_penalty+=H*60*60+M*60+S;
            }
            score1.AC=temp_AC;
            score1.penalty=temp_penalty;
            score1.name=team_name;
        }
        if(team_name!="NijeZivotJedanACM"||i==n){
            score1.AC=temp_AC;
            score1.penalty=temp_penalty;
            score1.name=team_name;
            set1.insert(score1);
        }
    }
    int place=0;
    for(auto i:set1){
        //cout<<i.name<<' '<<i.AC<<' '<<i.penalty<<'\n';
        if(i.name=="NijeZivotJedanACM"){
            break;
        }
        place++;
    }
    cout<<n-place<<'\n';
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 2 ms 340 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 2 ms 340 KB Output is correct
5 Correct 2 ms 340 KB Output is correct