# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
223371 | 2020-04-15T08:14:24 Z | maomao90 | ACM (COCI19_acm) | C++14 | 10 ms | 512 KB |
#include <cstdio> #include <string> #include <vector> #include <algorithm> #include <tuple> using namespace std; typedef tuple <int, int, string> iis; int N, M; vector <iis> standings; bool comp(iis right, iis left) { int rSolve, rTime, lSolve, lTime; string rName, lName; tie(rSolve, rTime, rName) = right; tie(lSolve, lTime, lName) = left; if (rSolve > lSolve) return true; else if (rSolve == lSolve) { if (rTime < lTime) return true; else if (rTime == lTime) { if (rName.compare(lName) < 0) return true; } } return false; } int main() { scanf("%d%d", &N, &M); for (int i = 0; i <= N; i++) { char temp[25]; scanf(" %s", temp); string name = temp; int penaltyTime = 0, solved = 0; for (int i = 0; i < M; i++) { char sxv[20]; scanf(" %s", sxv); char s = sxv[0]; if (s == '-') { continue; } else { solved++; int attempts = sxv[1] - '0'; penaltyTime += (attempts - 1) * (20 * 60); int hours = (sxv[3] - '0') * 10 + (sxv[4] - '0'), minutes = (sxv[6] - '0') * 10 + (sxv[7] - '0'), seconds = (sxv[9] - '0') * 10 + (sxv[10] - '0'); penaltyTime += seconds + minutes * 60 + hours * 60 * 60; } } if (name == "NijeZivotJedanACM" && i != N) continue; else { standings.emplace_back(solved, penaltyTime, name); } } sort(standings.begin(), standings.end(), comp); for (int i = 0; i < N; i++) { if (get<2>(standings[i]) == "NijeZivotJedanACM") { printf("%d\n", i + 1); return 0; } } }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 384 KB | Output is correct |
2 | Correct | 10 ms | 512 KB | Output is correct |
3 | Correct | 5 ms | 384 KB | Output is correct |
4 | Correct | 9 ms | 512 KB | Output is correct |
5 | Correct | 9 ms | 512 KB | Output is correct |