結果

問題 No.1142 XOR と XOR
ユーザー yuruhiyayuruhiya
提出日時 2020-08-01 20:19:51
言語 Ruby
(3.3.0)
結果
AC  
実行時間 439 ms / 2,000 ms
コード長 227 bytes
コンパイル時間 261 ms
コンパイル使用メモリ 7,552 KB
実行使用メモリ 33,664 KB
最終ジャッジ日時 2024-04-25 16:38:32
合計ジャッジ時間 11,355 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 245 ms
12,416 KB
testcase_01 AC 246 ms
12,160 KB
testcase_02 AC 248 ms
12,288 KB
testcase_03 AC 437 ms
33,536 KB
testcase_04 AC 407 ms
32,256 KB
testcase_05 AC 366 ms
28,416 KB
testcase_06 AC 403 ms
30,976 KB
testcase_07 AC 428 ms
32,368 KB
testcase_08 AC 432 ms
33,120 KB
testcase_09 AC 432 ms
33,124 KB
testcase_10 AC 439 ms
33,272 KB
testcase_11 AC 245 ms
12,160 KB
testcase_12 AC 246 ms
12,160 KB
testcase_13 AC 243 ms
12,416 KB
testcase_14 AC 349 ms
23,288 KB
testcase_15 AC 346 ms
25,984 KB
testcase_16 AC 251 ms
12,544 KB
testcase_17 AC 375 ms
30,592 KB
testcase_18 AC 276 ms
15,616 KB
testcase_19 AC 408 ms
31,104 KB
testcase_20 AC 347 ms
25,344 KB
testcase_21 AC 308 ms
19,328 KB
testcase_22 AC 284 ms
15,616 KB
testcase_23 AC 383 ms
31,104 KB
testcase_24 AC 422 ms
31,360 KB
testcase_25 AC 331 ms
22,656 KB
testcase_26 AC 406 ms
33,664 KB
testcase_27 AC 366 ms
28,928 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
a=r
b=r
x=s[a]
y=s[b]
p (0...M).sum{x[_1]*y[_1^k]}.%10**9+7
0