Submission #199699

#TimeUsernameProblemLanguageResultExecution timeMemory
199699triplem5dsPreokret (COCI18_preokret)C++14
50 / 50
6 ms376 KiB
#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 timeMemoryGrader output
Fetching results...