Submission #223371

#TimeUsernameProblemLanguageResultExecution timeMemory
223371maomao90ACM (COCI19_acm)C++14
50 / 50
10 ms512 KiB
#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 (stderr)

acm.cpp: In function 'int main()':
acm.cpp:32:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d%d", &N, &M);
     ~~~~~^~~~~~~~~~~~~~~~
acm.cpp:35:29: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         char temp[25]; scanf(" %s", temp);
                        ~~~~~^~~~~~~~~~~~~
acm.cpp:41:32: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
             char sxv[20]; scanf(" %s", sxv);
                           ~~~~~^~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...