# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
637819 | NotLinux | Preokret (COCI18_preokret) | C++14 | 1 ms | 340 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.
/**
* author: NotLinux
* created: 03.09.2022 ~ 13:16:03
**/
#include <bits/stdc++.h>
using namespace std;
#define int long long
#ifdef LOCAL
#include "/home/notlinux/debug.h"
#else
#define debug(x...) void(37)
#endif
void solve(){
int a,b;cin >> a;
vector < pair < int , int > > arr;
for(int i = 0;i<a;i++){
int num;cin >> num;
arr.push_back({num,0});
}
cin >> b;
for(int i = 0;i<b;i++){
int num;cin >> num;
arr.push_back({num,1});
}
sort(arr.begin(),arr.end());
int ans1 = 0;
int cnt1 = 0;
int cnt0 = 0;
int ans2 = 0;
int bl1,bl2,bl3;
debug(arr);
for(auto itr : arr){
if(itr.first <= 1440)ans1++;
if(itr.second)cnt1++;
else cnt0++;
bl3 = bl2;
bl2 = bl1;
if(cnt1 == cnt0)bl1 = 0;
else if(cnt1 < cnt0)bl1 = -1;
else bl1 = 1;
if((bl1 == 1 and bl3 == -1) or (bl1==-1 and bl3==1)){
ans2++;
}
}
cout << ans1 << endl;
cout << ans2 << endl;
}
int32_t main(){
ios_base::sync_with_stdio(0);cin.tie(nullptr);
int tt=1;
//cin >> tt;
while(tt--)solve();
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |