# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
257766 | HAjrhsa | Preokret (COCI18_preokret) | C++17 | 2 ms | 384 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;
void fst()
{
ios::sync_with_stdio(0);
cin.tie(0);
#ifndef ONLINE_JUDGE
freopen("input.txt", "r", stdin);
#endif
}
int pa[2881], pb[2881];
#define int long long
int32_t main()
{
//fst();
int a, b;
cin >> a ;
int x;
while (a--)
{
cin >> x;
pa[x]++;
}
cin>>b;
while (b--)
{
cin >> x;
pb[x]++;
}
int prev = 0, turn = 0;
for (int i = 1; i <= 2880; i++)
{
pa[i]+=pa[i-1];
pb[i]+=pb[i-1];
if (prev == 0)
{
if (pa[i] > pb[i])
prev = 1;
else if (pa[i] < pb[i])
prev = 2;
}
if(prev==1 && pa[i]<pb[i]){prev=2;turn++;}
if(prev==2 && pa[i]>pb[i]){prev=1;turn++;}
}
cout<<pa[1440]+pb[1440]<<"\n"<<turn<<"\n";
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |