結果

問題 No.1240 Or Sum of Xor Pair
ユーザー 👑 NachiaNachia
提出日時 2020-09-28 22:54:16
言語 cLay
(20240104-1)
結果
AC  
実行時間 140 ms / 2,000 ms
コード長 394 bytes
コンパイル時間 3,152 ms
コンパイル使用メモリ 163,032 KB
実行使用メモリ 44,548 KB
最終ジャッジ日時 2023-09-19 01:25:02
合計ジャッジ時間 9,139 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 109 ms
44,272 KB
testcase_01 AC 107 ms
44,464 KB
testcase_02 AC 112 ms
44,312 KB
testcase_03 AC 78 ms
44,392 KB
testcase_04 AC 85 ms
44,312 KB
testcase_05 AC 113 ms
44,480 KB
testcase_06 AC 85 ms
44,336 KB
testcase_07 AC 83 ms
44,460 KB
testcase_08 AC 80 ms
44,316 KB
testcase_09 AC 76 ms
44,320 KB
testcase_10 AC 100 ms
44,532 KB
testcase_11 AC 84 ms
44,548 KB
testcase_12 AC 102 ms
44,312 KB
testcase_13 AC 115 ms
44,332 KB
testcase_14 AC 89 ms
42,732 KB
testcase_15 AC 139 ms
44,344 KB
testcase_16 AC 123 ms
44,544 KB
testcase_17 AC 116 ms
44,332 KB
testcase_18 AC 122 ms
44,276 KB
testcase_19 AC 113 ms
44,496 KB
testcase_20 AC 140 ms
44,268 KB
testcase_21 AC 131 ms
44,272 KB
testcase_22 AC 134 ms
44,332 KB
testcase_23 AC 115 ms
44,432 KB
testcase_24 AC 132 ms
44,328 KB
testcase_25 AC 108 ms
44,288 KB
testcase_26 AC 130 ms
44,472 KB
testcase_27 AC 117 ms
44,264 KB
testcase_28 AC 114 ms
44,280 KB
testcase_29 AC 107 ms
44,420 KB
testcase_30 AC 120 ms
44,340 KB
testcase_31 AC 125 ms
44,280 KB
testcase_32 AC 107 ms
44,348 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

ll N,X,C[1<<18][19],z[18]={},D,x,Z=0,a;
{
    rd(N,X);
	rep(i,N){
		rd(a);
		rep(j,18) if(!(a&1<<j)) C[a][j]++;
		C[a][18]++;
	}
	rep(d,19){
		D=1<<d;
		if(X&D){
			x=(X-D)&~(D-1);
			for (int i=0; i<1<<18; i+=D) rep(j,18) z[j] += C[i][18]*C[i^x][18]-C[i][j]*C[i^x][j];
		}
		rep(i,1<<18){ if(i&D) rep(j,19) C[i-D][j]+=C[i][j]; }
	}
	rep(i,18) Z += ((z[i]-N+C[0][i])/2)<<i;
	wt(Z);
	return 0;
}
0