# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
495854 |
2021-12-20T06:27:56 Z |
AlperenT |
ACM (COCI19_acm) |
C++17 |
|
4 ms |
508 KB |
#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 time |
Memory |
Grader output |
1 |
Correct |
1 ms |
336 KB |
Output is correct |
2 |
Correct |
4 ms |
496 KB |
Output is correct |
3 |
Correct |
1 ms |
336 KB |
Output is correct |
4 |
Correct |
3 ms |
464 KB |
Output is correct |
5 |
Correct |
3 ms |
508 KB |
Output is correct |