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