L - Ray in the tube Gym——东二(??)

#include<bits/stdc++.h>
using namespace std;
const int M=1e5+5;
int up[M],down[M],ans=2,n,m;
map<int,int>mp;
int main()
{
    scanf("%d%*d",&n);
    for(int i=1;i<=n;++i)
        scanf("%d",&up[i]);
    scanf("%d%*d",&m);
    for(int i=1;i<=m;++i)
        scanf("%d",&down[i]);
    for(int d=2;d<=1e9;d<<=1)
	{
		mp.clear();
		for(int i=1;i<=n;++i){
            ++mp[up[i]%d];
            ans=max(ans,mp[up[i]%d]);
		}

		for(int i=1;i<=m;++i){
            ++mp[(down[i]+(d>>1))%d];
            ans=max(ans,mp[(down[i]+(d>>1))%d]);
		}
	}
	printf("%d",ans);
}

不懂,先贴出来

上一篇:Codeforces Gym - 101982C (dp)


下一篇:AI与Python - 强化学习