# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
99741 | Sa1loum | Preokret (COCI18_preokret) | C++14 | 4 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;
#define IO ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define mem(a,b) memset(a, b, sizeof(a))
#define F first
#define S second
#define Si size
#define pb(x) push_back(x)
typedef double D;
typedef long long ll;
typedef long double ld;
const int MOD=(int)1e9+7,MAX=(int)1e5+10;
int n,a[5000],m,b[5000],half;
int as[5000],bs[5000],first,ans;
int main()
{
cin>>n;
for (int i=0;i<n;i++) {
cin>>a[i];
if (a[i]<=2880/2) half++;
as[a[i]]++;
}
cin>>m;
for (int i=0;i<m;i++) {
cin>>b[i];
if (b[i]<=2880/2) half++;
bs[b[i]]++;
}
cout<<half<<endl;
first=min(a[0],b[0]);
int scorea=(first==a[0])? 1:0;
int scoreb=(first==b[0])? 1:0;
bool x=(scorea>scoreb);
for (int i=first+1;i<=2880;i++) {
scorea+=as[i];
scoreb+=bs[i];
if (scorea>scoreb) {
if (x==0) {
x=1;
ans++;
}
}
if (scorea<scoreb) {
if (x==1) {
x=0;
ans++;
}
}
}
cout<<ans;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |