Submission #701696

#TimeUsernameProblemLanguageResultExecution timeMemory
701696scottchouPreokret (COCI18_preokret)C++17
50 / 50
1 ms340 KiB
#include<bits/stdc++.h> using namespace std; int main(){ ios::sync_with_stdio(0); cin.tie(0); int n, m; cin >> n; vector<pair<int, bool> > a; int x, cnt = 0; for(int i = 0; i < n; i++){ cin >> x; if(x <= 1440) cnt++; a.push_back({x, 0}); } cin >> m; for(int i = 0; i < m; i++){ cin >> x; if(x <= 1440) cnt++; a.push_back({x, 1}); } sort(a.begin(), a.end()); cout << cnt << '\n'; int aa = !a[0].second, bb = a[0].second; bool now_win = a[0].second; int cnt2 = 0; for(int i = 1; i < a.size(); i++){ aa += !a[i].second; bb += a[i].second; if((aa > bb && now_win) || (aa < bb && !now_win)){ cnt2++; now_win = !now_win; } } cout << cnt2 << '\n'; }

Compilation message (stderr)

preokret.cpp: In function 'int main()':
preokret.cpp:29:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<int, bool> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   29 |     for(int i = 1; i < a.size(); i++){
      |                    ~~^~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...