結果

問題 No.1142 XOR と XOR
ユーザー yuruhiya
提出日時 2020-08-01 20:19:51
言語 Ruby
(3.4.1)
結果
AC  
実行時間 443 ms / 2,000 ms
コード長 227 bytes
コンパイル時間 373 ms
コンパイル使用メモリ 7,424 KB
実行使用メモリ 33,792 KB
最終ジャッジ日時 2024-11-08 03:44:01
合計ジャッジ時間 12,564 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 25
権限があれば一括ダウンロードができます
コンパイルメッセージ
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