Submission #246056

#TimeUsernameProblemLanguageResultExecution timeMemory
246056HalitACM (COCI19_acm)C++17
0 / 50
27 ms768 KiB
#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)

acm.cpp: In function 'long long int to_seconds(std::__cxx11::string)':
acm.cpp:62:18: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for(int i = 3;i < date.size();i+=3){
                ~~^~~~~~~~~~~~~
acm.cpp: In function 'bool name_cmp(std::__cxx11::string, std::__cxx11::string)':
acm.cpp:71:18: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for(int i = 0;i < str1.size();i++){
                ~~^~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...