# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
170332 | ngmh | Preokret (COCI18_preokret) | C++11 | 3 ms | 376 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |