题解:P12706 并非呃呃
KingGojianOfYue · · 题解
难度可能有些虚高吧。
前两个数据点可以自己比较容易进行构造,所以直接考虑构造
发现
- 任意一个
\sqrt{n} 元组的任意一个元素均为[1,\sqrt{n}] 中的整数; - 最多存在某一个位置相同的元素取值相等。
然后构造就简单得多了:将块长设为
代码:
#include<bits/stdc++.h>
#define puts(x) printf(x);printf("\n")
using namespace std;
bitset<2500>e;
int n,L;
int main()
{
scanf("%d%d",&n,&L);
if(n==4){
puts("1100");
puts("1001");
puts("0110");
puts("0011");
return 0;
}else if(n==10){
puts("0011000000");
puts("0110000000");
puts("1100000000");
puts("1001000000");
puts("1000110000");
puts("0100011000");
puts("1000001100");
puts("0100000110");
puts("1000000011");
puts("0100100001");
return 0;
}
for(int i=0;i<47;++i){
for(int k=0;k<47;++k){
for(int j=1;j<=2333;++j)e[j]=false;
for(int j=0;j<47;++j){
e[j*47+1+(i*j+k)%47]=true;
}
for(int j=1;j<=2333;++j){
if(e[j]==true)putchar('1');
else putchar('0');
}
putchar('\n');
}
}
for(int i=47*47+1;i<=2333;++i){
for(int j=0;j<2333;++j){
putchar('0');
}
putchar('\n');
}
return 0;
}/*
*/