QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#308918#8129. Binary Sequenceucup_team_qiuly#AC ✓24ms12176kbC++14768b2024-01-20 13:44:262024-01-20 13:44:26

Judging History

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

  • [2024-01-20 13:44:26]
  • 评测
  • 测评结果:AC
  • 用时:24ms
  • 内存:12176kb
  • [2024-01-20 13:44:26]
  • 提交

answer

#include <iostream>
#include <cstdio>
#define ll long long
using namespace std;
const int B=36;
int t;
ll n,m;
int len[40];
char s[40][1100005];
char qwq[10000005];
void trans(int x){
	int tot=0;
	for (int i=len[x];i>=1;i--){
		int j=i;
		while(j>1&&s[x][j-1]==s[x][i])j--;
		int l=i-j+1;
		qwq[++tot]=s[x][i];
		while(l>0)qwq[++tot]='0'+(l&1),l>>=1;
		i=j;
	}
	len[x+1]=min(tot,1100000);
	for (int i=1;i<=len[x+1];i++)s[x+1][i]=qwq[len[x+1]-i+1];
	return;
}
int main(){
	len[1]=1;
	s[1][1]='1';
	for (int i=1;i<=B;i++){
		trans(i);
	}
	cin>>t;
	while(t--){
		scanf("%lld%lld",&n,&m);
		if (n>B){
			if (n&1)n=B+1;
			else n=B;
		}
		if (m>=len[n])putchar('0');
		else putchar(s[n][len[n]-m]);
		putchar('\n');
	}
	return 0;
}

这程序好像有点Bug,我给组数据试试?

详细

Test #1:

score: 100
Accepted
time: 9ms
memory: 12172kb

input:

10
4 0
4 1
4 2
4 3
4 4
4 5
4 6
6 3
6 7
118999881999119725 3

output:

1
1
0
1
1
1
0
1
1
0

result:

ok 10 numbers

Test #2:

score: 0
Accepted
time: 6ms
memory: 12176kb

input:

10
28 69772
10 7908
4 3198
4 85913
14 52729
3 20445
9 88912
17 23743
25 37356
2 97697

output:

0
0
0
0
0
0
0
0
0
0

result:

ok 10 numbers

Test #3:

score: 0
Accepted
time: 10ms
memory: 12152kb

input:

100
29 110358
18 13645
18 590344
36 550462
11 133055
8 769352
11 265432
7 158530
12 29189
2 830361
11 584395
31 693707
7 879812
19 25069
21 616926
3 85158
31 675739
17 118385
24 315535
29 59615
10 33445
17 609235
8 738138
20 209540
4 287616
32 522302
26 959741
5 453537
27 74313
28 296289
28 857972
2...

output:

0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
1
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
1
1
0
0
0
0
1
0
0
0
0
0
1
0
1
0
1
0
1
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
1
0
0

result:

ok 100 numbers

Test #4:

score: 0
Accepted
time: 24ms
memory: 12032kb

input:

100000
702433635413308636 962533
864089450531108488 538792
262747333715821506 454514
859830947243984718 105219
365621373252206174 447331
890829905503831899 507146
116987306031929573 154370
157986473366693144 364746
502917586764426513 49981
874588963478161584 594867
467219058104100510 790503
11034861...

output:

1
1
1
1
1
1
1
0
1
0
1
0
1
1
1
1
0
1
1
1
1
1
0
1
0
0
0
0
1
1
1
0
0
1
1
0
0
1
0
1
1
1
1
0
0
0
0
1
1
0
0
1
0
0
1
0
1
1
1
1
1
1
1
0
1
1
1
0
0
0
1
1
1
0
1
1
1
1
1
1
0
1
0
1
1
1
0
0
0
1
0
0
1
0
1
1
1
1
1
1
0
0
0
0
0
0
0
1
0
0
1
0
1
0
1
0
1
1
0
1
1
0
1
0
0
0
1
1
0
1
1
0
0
1
1
1
1
1
0
0
0
0
0
0
1
1
1
0
0
1
...

result:

ok 100000 numbers

Extra Test:

score: 0
Extra Test Passed