Submission #92148

#TimeUsernameProblemLanguageResultExecution timeMemory
92148KastandaPreokret (COCI18_preokret)C++11
35.90 / 50
2 ms376 KiB
#include<bits/stdc++.h> using namespace std; const int TM = 4 * 12 * 60; int main() { int C[2] = {0, 0}; vector < pair < int , int > > A; for (int w = 0; w <= 1; w ++) { int n; scanf("%d", &n); for (int i = 1, a; i <= n; i++) scanf("%d", &a), A.push_back({a, w}); } int cnt1 = 0, cnt2 = 0; for (int i = 0; i < A.size(); i++) if (A[i].first < TM / 2) cnt1 ++; sort(A.begin(), A.end()); int loser = -1; for (int i = 0; i < A.size(); i++) { C[A[i].second] ++; if (loser == A[i].second && C[A[i].second] > C[!A[i].second]) cnt2 ++; if (C[A[i].second] > C[!A[i].second]) loser = !A[i].second; } return !printf("%d\n%d\n", cnt1, cnt2); }

Compilation message (stderr)

preokret.cpp: In function 'int main()':
preokret.cpp:16:23: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for (int i = 0; i < A.size(); i++)
                     ~~^~~~~~~~~~
preokret.cpp:21:23: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for (int i = 0; i < A.size(); i++)
                     ~~^~~~~~~~~~
preokret.cpp:11:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%d", &n);
         ~~~~~^~~~~~~~~~
preokret.cpp:13:28: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
             scanf("%d", &a), A.push_back({a, w});
             ~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...