CF387B 【George and Round】

暴力还真的出奇迹了
这题窝将读入的两个数组都先排个序,然后再枚举一遍就过了;

目前题解最短的代码QwQ。
这里是代码

#include<bits/stdc++.h>
using namespace std;
#define N 1000004
int n,m,a[N],b[N],l,r;
int main(){
cin>>n>>m;
for(int i=0;i<n;i++)
cin>>a[i];
for(int i=0;i<m;i++)
cin>>b[i];
sort(a,a+n),sort(b,b+m);
while(l<n&&r<m){
if(a[l]<=b[r])l++;
r++;
}
cout<<n-l<<endl;
return 0;
}

  

猜你喜欢

转载自www.cnblogs.com/20020219-liu/p/11609782.html