# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
87676 |
2018-12-01T20:07:03 Z |
Ort |
Preokret (COCI18_preokret) |
C++11 |
|
3 ms |
632 KB |
#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 |
1 |
Correct |
2 ms |
376 KB |
Output is correct |
2 |
Correct |
2 ms |
468 KB |
Output is correct |
3 |
Correct |
2 ms |
468 KB |
Output is correct |
4 |
Correct |
2 ms |
468 KB |
Output is correct |
5 |
Correct |
2 ms |
468 KB |
Output is correct |
6 |
Correct |
3 ms |
468 KB |
Output is correct |
7 |
Correct |
3 ms |
468 KB |
Output is correct |
8 |
Correct |
2 ms |
632 KB |
Output is correct |
9 |
Correct |
3 ms |
632 KB |
Output is correct |
10 |
Correct |
3 ms |
632 KB |
Output is correct |