# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
637115 | Ahmed57 | 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.
#include <bits/stdc++.h>
using namespace std;
int main(){
int a,b;
cin>>a;
vector<pair<int,int>> v;
int col = 0;
for(int i = 0;i<a;i++){
int x;cin>>x;
v.push_back({x,0});
if(x<=1440)col++;
}
cin>>b;
for(int i = 0;i<b;i++){
int x;cin>>x;
v.push_back({x,1});
if(x<=1440)col++;
}
sort(v.begin(),v.end());
cout<<col<<"\n";
vector<pair<int,int>>z;
int x = 0,y = 0 , ans = 0;
for(int i = 0;i<a+b;i++){
if(v[i].second==0)x++;
else y++;
if(x!=y)z.push_back({x,y});
}
for(int i = 1;i<z.size();i++){
if((z[i-1].first<z[i-1].second)!=(z[i].first<z[i].second))ans++;
}
cout<<ans<<"\n";
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |