#include <bits/stdc++.h>
using namespace std;
struct thonk{
int AC;
long long penalty;
string name;
};
bool comp(thonk a, thonk b){
if(a.AC != b.AC) return a.AC > b.AC;
else if(a.penalty != b.penalty) return a.penalty < b.penalty;
else return a.name < b.name;
}
///.-.
int main(){
//freopen("i.txt","r",stdin);
ios_base::sync_with_stdio(false);
int n, m; cin >> n >> m;
string me = "NijeZivotJedanACM";
string meme = me;
vector<thonk> why;
for(int i = 0;i <= n;i++){
string team; cin >> team;
if(team == me){
me = "-1";
for(int i = 0;i < m;i++){
string s; cin >> s;
}
continue;
}
long long penalty = 0;
int AC = 0;
for(int i = 0;i < m;i++){
string s; cin >> s;
if(s.size() <= 2) continue;
AC++;
long long WA = s[1] - '1';
long long hour = (s[3] - '0') * 10 + (s[4] - '0');
long long minute = (s[6] - '0') * 10 + (s[7] - '0');
long long second = (s[9] - '0') * 10 + (s[10] - '0');
penalty += WA * 60 * 20 + hour * 60 * 60 + minute * 60 + second;
//cout << WA << " " << hour << " " << minute << " " << second << "|";
}
why.push_back({AC,penalty,team});
//cout << team << " " << AC << " " << penalty << "\n";
}
sort(why.begin(),why.end(),comp);
for(int i = 0;i< (int)why.size();i++){
//cout << why[i].AC << " " << why[i].name <<"\n";
if(why[i].name == meme){
cout << i+1;
return 0;
}
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
5 ms |
384 KB |
Output is correct |
2 |
Correct |
8 ms |
384 KB |
Output is correct |
3 |
Correct |
5 ms |
384 KB |
Output is correct |
4 |
Correct |
7 ms |
384 KB |
Output is correct |
5 |
Correct |
7 ms |
384 KB |
Output is correct |