Submission #890285

#TimeUsernameProblemLanguageResultExecution timeMemory
890285pccPreokret (COCI18_preokret)C++14
50 / 50
1 ms348 KiB
#include <bits/stdc++.h> using namespace std; #define ll long long #define pll pair<ll,ll> #define pii pair<int,int> #define fs first #define sc second #define tlll tuple<ll,ll,ll> vector<pii> v; int main(){ ios::sync_with_stdio(0);cin.tie(0);cout.tie(0); int n; cin>>n; for(int i = 0;i<n;i++){ int k; cin>>k; v.push_back({k,1}); } cin>>n; for(int i = 0;i<n;i++){ int k; cin>>k; v.push_back({k,2}); } int ans1 = 0,ans2 = 0; sort(v.begin(),v.end()); int s = 0; int pre = 0; for(auto &i:v){ if(i.fs<=2*12*60)ans1++; if(i.sc == 1)s--; else s++; if(pre == 0)pre = s; if(s*pre<0){ ans2++; pre = s; } } cout<<ans1<<'\n'<<ans2; }
#Verdict Execution timeMemoryGrader output
Fetching results...