QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#285131#5434. Binary Substringsushg8877#WA 0ms3784kbC++14503b2023-12-16 16:39:352023-12-16 16:39:36

Judging History

你现在查看的是最新测评结果

  • [2023-12-16 16:39:36]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3784kb
  • [2023-12-16 16:39:35]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define MP make_pair
mt19937 rnd(time(0));
const int MAXN=5e5+5;
int n,k;
bool f[MAXN],used[MAXN];
void dfs(int p,int S){
	if(used[S]) return;
	f[p]=(S&1);used[S]=true;
	if(p==(k-1)+(1<<k)){
		for(int i=1;i<=n;i++) cout<<f[i];
		exit(0);
	}
	dfs(p+1,(S<<1)&((1<<k)-1));
	dfs(p+1,(S<<1|1)&((1<<k)-1));
	used[S]=false;
}
int main(){
	ios::sync_with_stdio(false);
	cin>>n;
	while(k-1+(1<<k)<n) k++;
	dfs(k,0);
	
}

詳細信息

Test #1:

score: 100
Accepted
time: 0ms
memory: 3696kb

input:

2

output:

01

result:

ok meet maximum 3

Test #2:

score: 0
Accepted
time: 0ms
memory: 3784kb

input:

5

output:

00110

result:

ok meet maximum 12

Test #3:

score: 0
Accepted
time: 0ms
memory: 3628kb

input:

1

output:

0

result:

ok meet maximum 1

Test #4:

score: 0
Accepted
time: 0ms
memory: 3700kb

input:

3

output:

001

result:

ok meet maximum 5

Test #5:

score: 0
Accepted
time: 0ms
memory: 3780kb

input:

4

output:

0011

result:

ok meet maximum 8

Test #6:

score: -100
Wrong Answer
time: 0ms
memory: 3632kb

input:

6

output:

000101

result:

wrong answer not meet maximum 15 < 16