Submission #222361

#TimeUsernameProblemLanguageResultExecution timeMemory
222361cheehengACM (COCI19_acm)C++14
50 / 50
6 ms256 KiB
#include <bits/stdc++.h> using namespace std; typedef pair<int, int> ii; char str[35]; char str2[35]; int main(){ int N, M; scanf("%d%d", &N, &M); int hero = -1; vector<ii> scores; int hero_solved = 0; int hero_penalty = 0; for(int i = 0; i <= N; i ++){ memset(str, 0, sizeof(str)); scanf(" %s", str); int indx = i; if(string(str) == "NijeZivotJedanACM"){ if(i < N){ hero = i; for(int j = 0; j < M; j ++){ scanf(" %s", str2); } continue; }else{ indx = hero; } } int solved = 0; int penalty = 0; for(int j = 0; j < M; j ++){ memset(str2, 0, sizeof(str2)); scanf(" %s", str2); if(str2[0] == '-'){ continue; }else{ penalty += 1200*(str2[1]-'0') + 36000*(str2[3]-'0') + 3600*(str2[4]-'0') + 600*(str2[6]-'0') + 60*(str2[7]-'0') + 10*(str2[9]-'0') + (str2[10]-'0'); //printf("%c\n", str2[1]); solved ++; } } if(i == N){ hero_solved = solved; hero_penalty = penalty; } //printf("%d %d\n", solved, penalty); scores.push_back(ii(solved, -penalty)); } sort(scores.begin(), scores.end()); reverse(scores.begin(), scores.end()); for(ii temp: scores){ //printf("Score: %d %d\n", temp.first, -temp.second); } int indx = 0; for(int i = 0; i < (int)scores.size(); i ++){ if(scores[i] == ii(hero_solved, -hero_penalty)){ printf("%d", i+1); return 0; } } return 0; }

Compilation message (stderr)

acm.cpp: In function 'int main()':
acm.cpp:19:13: warning: variable 'indx' set but not used [-Wunused-but-set-variable]
         int indx = i;
             ^~~~
acm.cpp:57:12: warning: variable 'temp' set but not used [-Wunused-but-set-variable]
     for(ii temp: scores){
            ^~~~
acm.cpp:61:9: warning: unused variable 'indx' [-Wunused-variable]
     int indx = 0;
         ^~~~
acm.cpp:10: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:18:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf(" %s", str);
         ~~~~~^~~~~~~~~~~~
acm.cpp:24:26: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
                     scanf(" %s", str2);
                     ~~~~~^~~~~~~~~~~~~
acm.cpp:36:18: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
             scanf(" %s", str2);
             ~~~~~^~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...