結果

問題 No.1142 XOR と XOR
ユーザー yuruhiyayuruhiya
提出日時 2020-08-01 20:20:12
言語 Ruby
(3.3.0)
結果
AC  
実行時間 423 ms / 2,000 ms
コード長 219 bytes
コンパイル時間 120 ms
コンパイル使用メモリ 7,424 KB
実行使用メモリ 32,256 KB
最終ジャッジ日時 2024-04-25 16:39:11
合計ジャッジ時間 10,860 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 243 ms
12,160 KB
testcase_01 AC 239 ms
12,416 KB
testcase_02 AC 239 ms
12,160 KB
testcase_03 AC 419 ms
32,256 KB
testcase_04 AC 390 ms
31,232 KB
testcase_05 AC 346 ms
27,520 KB
testcase_06 AC 392 ms
29,952 KB
testcase_07 AC 416 ms
31,104 KB
testcase_08 AC 423 ms
31,624 KB
testcase_09 AC 423 ms
31,716 KB
testcase_10 AC 418 ms
31,584 KB
testcase_11 AC 236 ms
12,160 KB
testcase_12 AC 240 ms
12,416 KB
testcase_13 AC 237 ms
12,288 KB
testcase_14 AC 341 ms
23,108 KB
testcase_15 AC 330 ms
25,088 KB
testcase_16 AC 241 ms
12,544 KB
testcase_17 AC 365 ms
29,440 KB
testcase_18 AC 266 ms
15,616 KB
testcase_19 AC 392 ms
30,336 KB
testcase_20 AC 334 ms
24,704 KB
testcase_21 AC 295 ms
19,328 KB
testcase_22 AC 271 ms
15,360 KB
testcase_23 AC 367 ms
30,976 KB
testcase_24 AC 397 ms
30,080 KB
testcase_25 AC 324 ms
22,656 KB
testcase_26 AC 395 ms
31,744 KB
testcase_27 AC 356 ms
27,776 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.rb:11: warning: assigned but unused variable - n
Syntax OK

ソースコード

diff #

def r
gets.split.map &:to_i
end
M=1024
s=->a{c=[1]+[x=0]*M
a.each{c[x^=_1]+=1}
t=[0]*M
(0...M).each{|i|(0...i).each{t[i^_1]+=c[i]*c[_1]}
t[0]+=c[i]*~-c[i]/2}
t}
*n,k=r
x=s[r]
y=s[r]
p (0...M).sum{x[_1]*y[_1^k]}.%10**9+7
0