# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
199699 | triplem5ds | Preokret (COCI18_preokret) | C++14 | 6 ms | 376 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.
#pragma GCC optimize ("O3")
#pragma GCC optimize ("unroll-loops")
#include "bits/stdc++.h"
using namespace std;
#define pb push_back
#define F first
#define S second
#define f(i,a,b) for(int i = a; i < b; i++)
// #define endl '\n'
using ll = long long;
using db = long double;
using ii = pair<int, int>;
const int N = 3e5 + 5, LG = 19, MOD = 1e9 + 7;
const int SQ =225;
const long double EPS = 1e-7;
int A,B,x,ans,ans2;
int cnt[2880];
int main(){
cin >> A;
f(i,0,A){
cin >> x;
cnt[x]++;
if(x<=1440)ans++;
}
cin >> B;
f(i,0,B){
cin >> x;
cnt[x]--;
if(x<=1440)ans++;
}
vector<int> vp;
int cur = 0;
f(i,1,2880){
if(cnt[i]){
cur += cnt[i];
if(vp.size() >= 2 && ((cur > 0 && vp[vp.size()-2] < 0)||(cur < 0 && vp[vp.size()-2] > 0))){
ans2++;
}
vp.push_back(cur);
}
}
cout << ans << "\n";
cout << ans2 << endl;
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |