# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
257766 | HAjrhsa | Preokret (COCI18_preokret) | C++17 | 2 ms | 384 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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";
}
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |