hack
查看原帖
hack
371278
herselfqwq楼主2023/3/28 15:23

请求撤下第二篇题解

复杂度是错误的,数据拉满要跑6秒以上

数据生成:

#include<bits/stdc++.h>
using namespace std;
int n=100000,m=20,M=(1<<20),cnt[1<<21],a[1<<21];
bool cmp(int A,int B){
	return cnt[A]>cnt[B];
}
inline int popcnt(int x){
	int res=0;
	while(x){
		res+=(x&1),x>>=1;
	}
	return res;
}
int main(){
	for(int i=0;i<M;i++){
		a[i]=i;
		cnt[i]=popcnt(i);
	}
	sort(a,a+M,cmp);
	printf("%d %d\n",n,m);
	for(int i=0;i<m;i++){
		for(int j=0;j<n;j++){
			putchar(((a[j]>>i)&1)?'H':'E');
		}
		putchar('\n');
	}
	return 0;
}
2023/3/28 15:23
加载中...