提交时间:2024-03-02 09:19:06
运行 ID: 133782
#include <bits/stdc++.h> using namespace std; #define start ios::sync_with_stdio(0),cin.tie(0),cout.tie(0) int G,S,g[300010],s[300010],adds; int cmp(int x,int y){ return x<y; } int main(){ start; cin>>G; for(int i=1;i<=G;i++) cin>>g[i]; cin>>S; for(int i=1;i<=S;i++) cin>>s[i]; sort(g+1,g+G+1,cmp); sort(s+1,s+S+1,cmp); adds=S+1; int cnt=0; for(int i=G;i>=1;i--){ adds=*lower_bound(s+1,s+adds+1,g[i]); cout<<adds<<endl; if(adds) { cnt++; } } cout<<cnt; }