#include <bits/stdc++.h>
using namespace std;
int main(){
int n, m;
cin >> n >> m;
vector<pair<pair<int, int>, string>> vec;
string our = "NijeZivotJedanACM";
for (int i = 0; i < n; i ++){
string name;
cin >> name;
int solved = 0;
int penalty = 0;
for (int j = 0; j < m; j ++){
string s;
cin >> s;
if (name == our or s[0] == '-') continue;
solved++;
int submissions = s[1] - '0';
penalty += (submissions - 1) * 20 * 60;
int h = s[4] - '0';
int m = (s[6] - '0') * 10 + (s[7] - '0');
int sec = (s[9] - '0') * 10 + (s[10] - '0');
penalty += (h * 3600 + m * 60 + sec);
}
if (name == our) continue;
vec.push_back({{-solved, penalty}, name});
}
string name;
cin >> name;
int solved = 0;
int penalty = 0;
for (int j = 0; j < m; j ++){
string s;
cin >> s;
if (s[0] == '-') continue;
solved++;
int submissions = s[1] - '0';
penalty += (submissions - 1) * 20 * 60;
int h = s[4] - '0';
int m = (s[6] - '0') * 10 + (s[7] - '0');
int sec = (s[9] - '0') * 10 + (s[10] - '0');
penalty += (h * 3600 + m * 60 + sec);
}
vec.push_back({{-solved, penalty}, name});
sort(vec.begin(), vec.end());
int i = 0;
for (auto [P, name] : vec){
i++;
// cout << i << " : " << name << " " << -P.first << " " << P.second << endl;
if (name == our){
cout << i << endl;
return 0;
}
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
2 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
5 ms |
476 KB |
Output is correct |
5 |
Correct |
5 ms |
764 KB |
Output is correct |