Skip to content

Instantly share code, notes, and snippets.

@enzerr
Created August 15, 2023 18:15
Show Gist options
  • Save enzerr/6b5d57b32783841a5c93c36046f48a83 to your computer and use it in GitHub Desktop.
Save enzerr/6b5d57b32783841a5c93c36046f48a83 to your computer and use it in GitHub Desktop.
#include<bits/stdc++.h>
using namespace std;
#define pii pair<int,int>
#define ff first
#define ss second
#define all(x) x.begin(),x.end()
int main(){
int a, b; cin >> a >> b;
vector<pii> v;
for(int i = 0; i < a; i++){
int x; cin >> x;
v.push_back({x,0});
}
for(int i = 0; i < b; i++){
int x; cin >> x;
v.push_back({x,1});
}
sort(all(v), greater<pii>());
for(int i = 1; i < v.size(); i++){
if(v[i].ss!=v[0].ss){
cout << i-1 << '\n';
break;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment