# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
207309 | socho | ACM (COCI19_acm) | C++14 | 16 ms | 760 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;
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 time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |