結果

問題 No.1240 Or Sum of Xor Pair
ユーザー tailstails
提出日時 2020-09-28 21:16:37
言語 cLay
(20240104-1)
結果
AC  
実行時間 263 ms / 2,000 ms
コード長 454 bytes
コンパイル時間 2,538 ms
コンパイル使用メモリ 161,556 KB
実行使用メモリ 7,684 KB
最終ジャッジ日時 2023-09-19 01:25:13
合計ジャッジ時間 9,723 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 100 ms
5,504 KB
testcase_01 AC 100 ms
5,352 KB
testcase_02 AC 175 ms
5,384 KB
testcase_03 AC 225 ms
7,520 KB
testcase_04 AC 191 ms
7,404 KB
testcase_05 AC 192 ms
7,676 KB
testcase_06 AC 175 ms
7,464 KB
testcase_07 AC 258 ms
7,480 KB
testcase_08 AC 179 ms
7,408 KB
testcase_09 AC 169 ms
7,396 KB
testcase_10 AC 168 ms
7,456 KB
testcase_11 AC 204 ms
7,424 KB
testcase_12 AC 174 ms
7,592 KB
testcase_13 AC 243 ms
7,560 KB
testcase_14 AC 235 ms
7,472 KB
testcase_15 AC 263 ms
7,596 KB
testcase_16 AC 210 ms
7,508 KB
testcase_17 AC 115 ms
7,488 KB
testcase_18 AC 237 ms
7,552 KB
testcase_19 AC 191 ms
7,460 KB
testcase_20 AC 193 ms
7,508 KB
testcase_21 AC 223 ms
7,684 KB
testcase_22 AC 218 ms
7,528 KB
testcase_23 AC 187 ms
7,464 KB
testcase_24 AC 154 ms
7,544 KB
testcase_25 AC 144 ms
7,440 KB
testcase_26 AC 122 ms
7,488 KB
testcase_27 AC 104 ms
5,384 KB
testcase_28 AC 111 ms
5,360 KB
testcase_29 AC 262 ms
5,436 KB
testcase_30 AC 152 ms
5,460 KB
testcase_31 AC 118 ms
5,356 KB
testcase_32 AC 195 ms
7,032 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

ll d[512][9],e[1<<18],f[512],z;

{
	int n,x,a;
	rd(n,x--);
	rep(n){
		rd(a);
		rep(j,9)d[a>>9][j]+=~a>>j&1;
		e[a]++;
		f[a>>9]++;
	}
	rep(i,512){
		rep(j,512){
			if((i^j)==x>>9){
				rep(k,i<<9,i+1<<9){
					rep(l,j<<9,j+1<<9){
						if((k^l)<=x){
							z+=e[k]*(e[l]-(k==l))*(k|l);
						}
					}
				}
			}
			if((i^j)<x>>9){
				z+=f[i]*(f[j]-(i==j))*((i|j)<<9|511);
				rep(k,9){
					z-=d[i][k]*(d[j][k]-(i==j))<<k;
				}
			}
		}
	}
	wt(z/2);
}
0