QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#309314#8129. Binary Sequenceucup-team191#AC ✓61ms29060kbC++141.1kb2024-01-20 16:37:092024-01-20 16:37:09

Judging History

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

  • [2024-01-20 16:37:09]
  • 评测
  • 测评结果:AC
  • 用时:61ms
  • 内存:29060kb
  • [2024-01-20 16:37:09]
  • 提交

answer

#include <bits/stdc++.h>
#define x first
#define y second
using namespace std;
using ll=long long;
using pii=pair<int,int>;
using vi=vector<int>;
using vl=vector<ll>;
#define pb push_back
#define all(a) begin(a),end(a)

const int N=300010,MOD=1e9+7;
const char en='\n';
const ll LLINF=1ll<<60;

int t;
ll n,m;
vector<string> re;

int main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	string s="1";
	int ms=2e6;
	for (int z=0;z<1000;++z)
	{
		string no;
		int cn=1;
		char cu='1';
		for (int i=1;i<(int)s.size();++i)
		{
			if (s[i]!=s[i-1])
			{
				for (int j=__lg(cn);j>=0;--j) no.pb('0'+((cn>>j)&1));
				no.pb(cu);
				cn=1;
				cu=s[i];
			}
			else ++cn;
		}
		for (int j=__lg(cn);j>=0;--j) no.pb('0'+((cn>>j)&1));
		no.pb(cu);
		if ((int)no.size()>ms) no=no.substr(no.size()-ms);
		s=no;
		re.pb(s);
		if (z>40)
		{
			if (re[z].substr(ms/2)==re[z-2].substr(ms/2)) break;
		}
	}
	re.insert(re.begin(),"1");
	cin>>t;
	while (t--)
	{
		cin>>n>>m;
		--n;
		if (n>=re.size())
		{
			n-=(n-re.size()+2)/2*2;
		}
		if (re[n].size()<=m) cout<<0<<en;
		else cout<<re[n][re[n].size()-m-1]<<en;
	}
}

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

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 57ms
memory: 27132kb

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: 57ms
memory: 29060kb

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: 54ms
memory: 28044kb

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: 61ms
memory: 28796kb

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