QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#667838#9518. 观虫我 (旧版数据)zhouhuanyi0 8733ms426280kbC++141.2kb2024-10-23 08:40:082024-10-23 08:40:17

Judging History

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

  • [2024-10-23 08:40:17]
  • 评测
  • 测评结果:0
  • 用时:8733ms
  • 内存:426280kb
  • [2024-10-23 08:40:08]
  • 提交

answer

#include<iostream>
#include<cstdio>
#include<bitset>
#define N 100
#define M 16384
using namespace std;
unsigned int read()
{
	char c=0;
	unsigned int sum=0;
	while (c<'0'||c>'9') c=getchar();
	while ('0'<=c&&c<='9') sum=sum*10+c-'0',c=getchar();
	return sum;
}
int n,q,sz;
bool res;
unsigned long long B[1<<12][M+1],delta[1<<10][M+1],delta2[1<<10][M+1];
int main()
{
	char op;
	int s1,s2,d1,d2,w;
	unsigned int x;
	unsigned long long dw;
	for (int i=0;i<(1<<10);++i)
		for (int j=0;j<(1<<10);++j)
			if ((j&i)==j)
			{
				for (int k=0;k<(1<<10);++k) w=j|(k<<10),delta[i][w>>6]|=(1ull<<(w&63));
			}
	for (int i=0;i<(1<<10);++i)
		for (int j=0;j<(1<<10);++j)
			if ((j&i)==j)
			{
				for (int k=0;k<(1<<10);++k) w=k|(j<<10),delta2[i][w>>6]|=(1ull<<(w&63));
			}
	n=read(),q=read(),sz=1<<max(n-18,0);
	for (int i=1;i<=q;++i)
	{
		cin>>op,x=read();
		if (op=='!')
		{
			s1=x&((1<<12)-1),s2=x>>12,d1=s2>>6,d2=s2&63,dw=1ull<<d2;
			for (int j=s1;j<(1<<12);j=(j+1)|s1) B[j][d1]^=dw;
		}
		else
		{
			s1=x&((1<<12)-1),s2=x>>12,d1=s2&((1<<10)-1),d2=s2>>10,res=0;
			for (int j=0;j<sz;++j) res^=__builtin_parityll(B[s1][j]&delta[d1][j]&delta2[d2][j]);
			printf("%d\n",res);
		}
	}
	return 0;
}

详细

Subtask #1:

score: 0
Time Limit Exceeded

Test #1:

score: 20
Accepted
time: 2150ms
memory: 193884kb

input:

24 1000000
! 9475137
! 4501536
? 14277831
? 16695039
? 5723102
? 6093887
? 3014539
! 475969
? 12500973
! 8750136
? 15617895
! 4589313
! 152300
? 3612579
? 15248179
! 764162
! 4461105
? 7274495
? 13299697
! 8388872
? 13490383
! 3875594
! 9439685
? 16776189
! 6443172
? 13864879
! 395691
? 7142271
? 16...

output:

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

result:

ok Accepted.

Test #2:

score: 0
Time Limit Exceeded

input:

24 1000000
! 0
? 16777215
! 0
! 0
! 262144
? 16777215
? 16777215
? 15728639
! 0
? 16777215
? 16777215
! 16384
? 16777211
! 0
? 16777215
! 0
! 0
? 16760831
! 0
! 0
? 16777215
! 0
? 16777215
! 0
? 16777215
! 0
? 16777215
? 16777215
! 0
! 0
? 16777215
? 16777215
? 16777215
? 16777215
! 32768
? 16777215...

output:

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

result:


Subtask #2:

score: 0
Time Limit Exceeded

Test #11:

score: 20
Accepted
time: 2336ms
memory: 280500kb

input:

26 1000000
! 18006034
? 66957270
! 2133064
! 147618
! 34621442
? 49715575
? 62879287
! 18620682
? 67073751
! 62941186
! 7634532
? 67100031
? 12517237
! 4804997
? 65991126
! 138275
? 65722687
? 66043391
! 19147234
? 45743743
! 2242648
! 44378336
? 48226020
! 34341926
! 665045
? 55433083
! 5554254
? 4...

output:

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

result:

ok Accepted.

Test #12:

score: 0
Time Limit Exceeded

input:

26 1000000
! 0
! 16779264
! 4
? 67092479
? 67108863
! 1048832
! 0
? 67108863
? 67108863
? 67108863
? 67108863
! 0
! 0
! 0
? 67108863
! 2048
? 67108863
! 0
? 66584575
! 8192
! 0
? 67108863
? 67108863
! 0
! 0
? 67092479
? 67108863
! 0
? 67108863
? 67108863
? 67108863
? 67108863
? 67108863
! 0
? 671088...

output:

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

result:


Subtask #3:

score: 0
Time Limit Exceeded

Test #21:

score: 20
Accepted
time: 4205ms
memory: 331660kb

input:

28 1000000
! 1081468
! 128476263
! 67930241
? 94304031
! 103698752
! 19982
! 198050624
? 249519591
? 71286719
? 255700799
! 103309888
! 819340
! 12852092
? 124739445
? 192734967
! 101320328
! 117594711
? 252032927
! 134267948
? 262940285
! 3155972
? 267876218
! 41984160
? 246413294
? 246824252
? 163...

output:

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

result:

ok Accepted.

Test #22:

score: 0
Time Limit Exceeded

input:

28 1000000
! 0
? 268435455
? 268435455
? 268435455
? 268435455
? 268435454
! 262144
! 2097152
? 268435455
? 266338303
! 0
? 268435455
? 268431359
? 268435455
? 268435199
? 268435455
! 0
? 268435455
? 268304383
? 268435455
? 267386871
! 0
! 0
! 0
! 8192
? 234881023
? 268435455
? 268435455
? 268435455...

output:

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

result:


Subtask #4:

score: 0
Time Limit Exceeded

Test #31:

score: 20
Accepted
time: 8733ms
memory: 426280kb

input:

30 1000000
! 33852274
? 1017904007
? 1046413001
! 151029382
? 466826079
? 250568375
! 6769874
! 2106474
? 536832803
? 209627867
! 167104971
? 1048372157
! 245380745
! 25174496
? 819646460
! 539548800
! 671358165
? 402955591
? 527753201
! 582494209
? 862862931
? 938974695
? 263672827
? 366968669
? 87...

output:

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
1
1
0
1
0
1
1
0
0
0
1
1
0
0
1
1
0
0
0
1
0
0
0
0
0
1
0
0
1
1
0
1
0
0
0
0
1
1
0
0
0
1
0
0
1
0
0
0
1
0
0
1
1
0
1
0
1
1
1
1
0
1
1
1
1
1
1
0
1
1
0
0
1
0
1
1
0
1
0
0
0
1
1
1
1
0
1
1
0
1
1
1
0
1
0
1
1
0
1
0
1
0
1
0
0
0
0
0
0
1
1
1
1
1
1
0
0
1
0
0
1
0
1
1
1
...

result:

ok Accepted.

Test #32:

score: 0
Time Limit Exceeded

input:

30 1000000
! 16777216
? 1073741823
! 0
! 0
! 0
? 1073741823
? 1073741823
? 1056964607
? 1073741823
! 0
? 1073741823
! 0
! 0
? 1073741823
? 1073741823
! 0
! 0
? 1073741823
! 0
? 1069408255
! 0
? 1073741823
! 0
? 1073741823
! 0
? 1073741823
! 128
! 131072
? 1073741823
? 1073741823
? 1073741823
? 10737...

output:

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

result:


Subtask #5:

score: 0
Time Limit Exceeded

Test #41:

score: 0
Time Limit Exceeded

input:

32 1000000
! 2474971548
! 348268033
? 1055293046
? 3382525679
? 1805515707
? 3210332902
? 2805668987
? 4025974780
! 2217771280
! 176949664
! 4213841344
! 1477473321
? 3150869759
? 2127418041
! 1610631720
! 3624477314
! 2288149532
! 70909964
! 40117153
! 1343751456
? 3758095615
! 513059275
! 31956816...

output:

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

result: