# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
341935 | Hazem | Preokret (COCI18_preokret) | C++14 | 1 ms | 364 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.
/*
ID: tmhazem1
LANG: C++14
TASK: pprime
*/
#include <bits/stdc++.h>
using namespace std;
#define S second
#define F first
#define LL long long
const int N = 2e5 + 10;
LL LINF = 100000000000000000;
LL INF = 1000000000;
int MOD = 1e9+7;
vector<pair<int,int>>vec;
int cnt[N][2];
int main()
{
// freopen("out.txt","w",stdout);
int n,m;
scanf("%d",&n);
for(int i=1;i<=n;i++){
int x;scanf("%d",&x);
vec.push_back({x,0});
}
scanf("%d",&m);
for(int i=1;i<=m;i++){
int x;scanf("%d",&x);
vec.push_back({x,1});
}
vec.push_back({0,3});
sort(vec.begin(),vec.end());
int cnt1 = 0,cnt2 = 0;
for(int i=1;i<vec.size();i++){
if(vec[i].F<=1440)cnt1++;
for(int j=0;j<2;j++)
cnt[i][j] = cnt[i-1][j]+(vec[i].S==j);
if(i<=2||cnt[i][0]==cnt[i][1])continue;
int idx = cnt[i][0]>cnt[i][1]?0:1;
cnt2 += cnt[i-2][idx]<cnt[i-2][!idx];
}
printf("%d\n%d",cnt1,cnt2);
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |