# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
207309 | socho | ACM (COCI19_acm) | C++14 | 16 ms | 760 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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... |