# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
87676 | Ort | Preokret (COCI18_preokret) | C++11 | 3 ms | 632 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<iostream>
#include<vector>
using namespace std;
int main()
{
ios::sync_with_stdio(0);
cin.tie(0);
int a, b;
int pola = 1440;
int gol = 0;
cin >> a;
vector<int> tima(a);
for(int i=0;i<a;i++) {
cin >> tima[i];
if(tima[i]<=pola) gol++;
}
cin >> b;
vector<int> timb(b);
for(int i=0;i<b;i++){
cin >> timb[i];
if(timb[i]<=pola) gol++;
}
int tr = a+b;
int gola = 0,golb = 0;
int sol = 0;
int vara = 0, varb = 0;
if(tima[0]<timb[0]) {
gola++; vara++;
}
else {
golb++; varb++;
}
bool ona = 1; bool onb = 1;
int proslia = 0, proslib = 0;
for(int i=0;i<tr;i++) {
if(vara>=a) ona = 0;
if(varb>=b) onb = 0;
if(gola==golb) {
if(tima[vara]<timb[varb] && ona) {
vara++; gola++;
if(proslia<proslib) sol++;
}
else if(tima[vara]>timb[varb] && onb) {
varb++; golb++;
if(proslia>proslib) sol++;
}
continue;
}
proslia = gola; proslib = golb;
if(tima[vara]<timb[varb] && ona) {
vara++; gola++;
}
else if(tima[vara]>timb[varb] && onb) {
varb++; golb++;
}
// printf("tim a %d tim b %d\n", gola, golb);
}
// cout << endl;
cout << gol << "\n" << sol;
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |