Untitled
unknown
plain_text
8 months ago
755 B
0
Indexable
Never
#include <bits/stdc++.h> using namespace std; void solve(){ int n; int res=INT_MIN; cin>>n; vector<int>arr,dep; for(int i=0;i<n;i++){ int x; cin>>x; arr.push_back(x); } for(int i=0;i<n;i++){ int x; cin>>x; dep.push_back(x); } //END OF INPUT int i=0,j=0; sort(arr.begin(),arr.end()); sort(dep.begin(),dep.end()); int count=0; while(i<n){ if(arr[i]<dep[j]){ count++; i++; }else{ count--; j++; } res=max(res,count); } cout<<res<<"\n"; } signed main() { ios_base::sync_with_stdio(0); cin.tie(0);cout.tie(0); int t; cin>>t; while(t--) solve(); }
Leave a Comment