Submission #495854

#TimeUsernameProblemLanguageResultExecution timeMemory
495854AlperenTACM (COCI19_acm)C++17
50 / 50
4 ms508 KiB
#include <bits/stdc++.h> using namespace std; const int N = 1000 + 5; int n, m, indx; string str; struct Team{ string name; int solved, penalty; bool operator < (const Team &scnd) const{ if(solved != scnd.solved) return solved > scnd.solved; else{ if(penalty != scnd.penalty) return penalty < scnd.penalty; else return name < scnd.name; } } }; Team teams[N]; int timetoint(string str){ int secs = 0; secs += stoi(str.substr(0, 2)) * 3600; secs += stoi(str.substr(3, 2)) * 60; secs += stoi(str.substr(6, 2)); return secs; } int main(){ ios_base::sync_with_stdio(false);cin.tie(NULL); cin >> n >> m; indx = 1; for(int i = 1; i <= n; i++){ cin >> teams[indx].name; if(teams[indx].name != "NijeZivotJedanACM"){ for(int j = 0; j < m; j++){ cin >> str; if(str[0] == '+' || str[0] == '?'){ teams[indx].solved++; teams[indx].penalty += (str[1] - '0' - 1) * 1200 + timetoint(str.substr(3, 8)); } } indx++; } else{ for(int i = 0; i < m; i++) cin >> str; } } cin >> teams[n].name; for(int j = 0; j < m; j++){ cin >> str; if(str[0] == '+' || str[0] == '?'){ teams[n].solved++; teams[n].penalty += (str[1] - '0' - 1) * 1200 + timetoint(str.substr(3, 8)); } } sort(teams + 1, teams + n + 1); for(int i = 1; i <= n; i++) if(teams[i].name == "NijeZivotJedanACM") cout << i; }
#Verdict Execution timeMemoryGrader output
Fetching results...