Submission #170332

#TimeUsernameProblemLanguageResultExecution timeMemory
170332ngmhPreokret (COCI18_preokret)C++11
50 / 50
3 ms376 KiB
#include <bits/stdc++.h> using namespace std; typedef pair<long long, long long> pi; long long a, b, t, l, s, p; vector<pi> v; int main(){ cin >> a; for(int i = 0 ; i < a; i++){ cin >> t; v.push_back(pi(t, 0)); } cin >> b; for(int i = 0; i < b; i++){ cin >> t; v.push_back(pi(t, 1)); } sort(v.begin(), v.end()); a = 0; b = 0; t = 0; l = 1440, s = -1; for(int i = 0; i < v.size(); i++){ if(t == 0 && v[i].first > l) t = a+b; if(v[i].second == 1) b++; else a++; if(a > b && s == 1){ s = 0; p++; } if(b > a && s == 0){ s = 1; p++; } if(s == -1){ if(a > b) s = 0; else s = 1; } } if(t == 0) t = a+b; cout << t << "\n" << p; }

Compilation message (stderr)

preokret.cpp: In function 'int main()':
preokret.cpp:21:19: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for(int i = 0; i < v.size(); i++){
                 ~~^~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...