# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
339594 | ammar2000 | Preokret (COCI18_preokret) | C++17 | 2 ms | 620 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;
int a,b,fh,cb;
char cw='s';
map <int ,char> c;
int main()
{
cin>>a;
while (a--)
{
int y;
cin>>y;
if (y<=1440)
fh++;
c[y]='a';
}
cin>>b;
while (b--)
{
int y;
cin>>y;
if (y<=1440)
fh++;
c[y]='b';
}
a=b=0;
for (int i=1;i<=2888;i++)
{
if (c[i]=='a')
a++;
else if (c[i]=='b')
b++;
if (cw=='s')
{
if (a>b)
cw='a';
else if (a<b)
cw='b';
}
else
{
if (a>b)
{
if (cw=='b')
cb++;
cw='a';
}
else if (b>a)
{
if (cw=='a')
cb++;
cw='b';
}
}
}
cout <<fh<<" "<<cb;
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |