Submission #207309

#TimeUsernameProblemLanguageResultExecution timeMemory
207309sochoACM (COCI19_acm)C++14
50 / 50
16 ms760 KiB
#include "bits/stdc++.h" using namespace std; bool comp(pair<int, pair<int, string> > a, pair<int, pair<int, string> > b) { if (a.first > b.first) return true; if (a.first < b.first) return false; if (a.second.first < b.second.first) return true; if (a.second.first > b.second.first) return false; return a.second.second < b.second.second; } string us = "NijeZivotJedanACM"; int wrong_penalty = 20 * 60; int main() { int n, t; cin >> n >> t; vector<pair<int, pair<int, string> > > scores; for (int i=0; i<n; i++) { string teamname; cin >> teamname; string results[t]; for (int i=0; i<t; i++) { cin >> results[i]; } if (teamname == us) continue; int solved = 0; int penalty = 0; for (int i=0; i<t; i++) { string curr = results[i]; if (curr[0] == '-') { // can't have solved } else { // has solved if ? or + int attempts = (curr[1] - '0'); int wrong_attempts = attempts - 1; solved++; penalty += wrong_penalty * wrong_attempts; int hh = (curr[3] - '0') * 10 + (curr[4] - '0'); int mm = (curr[6] - '0') * 10 + (curr[7] - '0'); int ss = (curr[9] - '0') * 10 + (curr[10] - '0'); int seconds = hh * 60 * 60 + mm * 60 + ss; penalty += seconds; } } scores.push_back(make_pair(solved, make_pair(penalty, teamname))); } string teamname; cin >> teamname; string results[t]; for (int i=0; i<t; i++) { cin >> results[i]; } int solved = 0; int penalty = 0; for (int i=0; i<t; i++) { string curr = results[i]; if (curr[0] == '-') { // can't have solved } else { // has solved if + int attempts = (curr[1] - '0'); int wrong_attempts = attempts - 1; solved++; penalty += wrong_penalty * wrong_attempts; int hh = (curr[3] - '0') * 10 + (curr[4] - '0'); int mm = (curr[6] - '0') * 10 + (curr[7] - '0'); int ss = (curr[9] - '0') * 10 + (curr[10] - '0'); int seconds = hh * 60 * 60 + mm * 60 + ss; penalty += seconds; } } scores.push_back(make_pair(solved, make_pair(penalty, teamname))); sort(scores.begin(), scores.end(), comp); for (int i=0; i<n; i++) { if (scores[i].second.second == us) cout << i+1 << endl; } }
#Verdict Execution timeMemoryGrader output
Fetching results...