結果
| 問題 | No.1072 A Nice XOR Pair |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2021-11-05 16:34:29 |
| 言語 | Ruby (3.4.1) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 400 bytes |
| 記録 | |
| コンパイル時間 | 227 ms |
| コンパイル使用メモリ | 7,552 KB |
| 実行使用メモリ | 23,680 KB |
| 最終ジャッジ日時 | 2024-11-06 07:12:20 |
| 合計ジャッジ時間 | 6,163 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 8 WA * 3 |
コンパイルメッセージ
Syntax OK
ソースコード
N, X = gets.split(" ").map{|s| s.to_i}
a = []
N.times {
a << gets.to_i
}
a.sort!
cnt = 0
a.uniq.each {|y|
ymin = a.bsearch_index{|i| i >= y}
ymax = a.bsearch_index{|i| i > y}
ymax = N if not ymax
ycnt = ymax - ymin
z = y ^ X
zmin = a.bsearch_index{|i| i >= z}
next if not zmin
zmax = a.bsearch_index{|i| i > z}
zmax = N if not zmax
zcnt = zmax - zmin
cnt += ycnt * zcnt
}
puts cnt / 2