Submission #160788

#TimeUsernameProblemLanguageResultExecution timeMemory
160788sochoPreokret (COCI18_preokret)C++14
50 / 50
3 ms380 KiB
#include "bits/stdc++.h" using namespace std; int main() { vector<pair<int, int> > evt; int a; cin >> a; for (int i=0; i<a; i++) { int t; cin >> t; evt.push_back(make_pair(t, 0)); } int b; cin >> b; for (int i=0; i<b; i++) { int t; cin >> t; evt.push_back(make_pair(t, 1)); } sort(evt.begin(), evt.end()); int ac = 0; int bc = 0; int fh = 0; vector<int> lead; for (int i=0; i<evt.size(); i++) { int tm = evt[i].first; int si = evt[i].second; if (tm <= 1440) fh++; if (si == 0) ac++; else bc++; if (ac > bc) { lead.push_back(0); } else if (bc > ac) { lead.push_back(1); } } int ta = 0; for (int i=0; i<lead.size()-1; i++) { if (lead[i] != lead[i+1]) ta++; } cout << fh << endl << ta << endl; }

Compilation message (stderr)

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