# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
246057 | Halit | ACM (COCI19_acm) | C++17 | 19 ms | 512 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
long long to_seconds(string date);
bool name_cmp(string str1, string str2);
const long long penalty_time = 20 * 60;
const int N = 1000, M = 15;
const string Cro_Team = "NijeZivotJedanACM";
int n,m;
map<string, long long> points;
map<string, long long> solved_problems;
int main(){
cin >> n >> m;
for(int i = 1;i <= n;i++){
string team_name;
cin >> team_name;
for(int j = 1;j <= m;j++){
string verdict;
cin >> verdict;
if(team_name == Cro_Team)
continue;
points[team_name] += to_seconds(verdict);
solved_problems[team_name] += verdict[0] != '-';
}
}
for(int i = 1;i <= n;i++){
string verdict;
cin >> verdict;
points[Cro_Team] += to_seconds(verdict);
solved_problems[Cro_Team] += verdict[0] != '-';
}
auto cmp = [&](string str) -> bool{
if(solved_problems[str] < solved_problems[Cro_Team]){
return 0;
} if(solved_problems[str] == solved_problems[Cro_Team]){
return (points[str] == points[Cro_Team] ? name_cmp(Cro_Team,str) : points[str] <= points[Cro_Team] );
}
return 1;
};
long long ans = 0;
for(auto it = points.begin(); it != points.end();it++){
//cout << (*it).first << " " << (*it).second << " " << solved_problems[(*it).first] << "\n";
ans += cmp((*it).first);
}
cout << ans;
}
long long to_seconds(string date){
if(date[0] == '-')
return 0;
long long s = penalty_time * (date[1] - '0' - 1);
long long product = 60 * 60;
for(int i = 3;i < date.size();i+=3){
s += ((date[i] - '0' * 10) + (date[i+1] - '0')) * product;
product /= 60;
}
return s;
}
bool name_cmp(string str1, string str2){
for(int i = 0;i < str1.size();i++){
if(str1[i] < str2[i])
return 0;
if(str1[i] > str2[i])
return 1;
}
return 1;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |