# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
160788 | 2019-10-30T00:32:31 Z | socho | Preokret (COCI18_preokret) | C++14 | 3 ms | 380 KB |
#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
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 256 KB | Output is correct |
2 | Correct | 2 ms | 256 KB | Output is correct |
3 | Correct | 2 ms | 376 KB | Output is correct |
4 | Correct | 2 ms | 376 KB | Output is correct |
5 | Correct | 2 ms | 256 KB | Output is correct |
6 | Correct | 3 ms | 376 KB | Output is correct |
7 | Correct | 3 ms | 376 KB | Output is correct |
8 | Correct | 3 ms | 376 KB | Output is correct |
9 | Correct | 3 ms | 380 KB | Output is correct |
10 | Correct | 2 ms | 376 KB | Output is correct |