結果

問題 No.602 隠されていたゲーム2
ユーザー letrangerjpletrangerjp
提出日時 2017-12-02 00:45:01
言語 Ruby
(3.3.0)
結果
WA  
実行時間 -
コード長 237 bytes
コンパイル時間 234 ms
コンパイル使用メモリ 7,552 KB
実行使用メモリ 21,120 KB
最終ジャッジ日時 2024-05-06 00:26:11
合計ジャッジ時間 4,112 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 91 ms
12,160 KB
testcase_01 AC 83 ms
12,288 KB
testcase_02 AC 85 ms
12,288 KB
testcase_03 AC 85 ms
12,416 KB
testcase_04 WA -
testcase_05 WA -
testcase_06 AC 84 ms
12,032 KB
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 AC 84 ms
12,160 KB
testcase_16 AC 108 ms
13,056 KB
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 AC 251 ms
20,352 KB
testcase_21 AC 247 ms
20,352 KB
testcase_22 WA -
testcase_23 AC 250 ms
20,992 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.rb:15: warning: ambiguous first argument; put parentheses or a space even after `-' operator
Syntax OK

ソースコード

diff #

N = gets.to_i
D = gets.split.map(&:to_i).sort
X, Y = gets.split.map &:to_i
dist = X.abs + Y.abs
if dist == 0
  p 2
elsif D.include?(dist)
  p 1
elsif D.any?{|d|
    a = (dist - d).abs
    D.bsearch{|dd|dd == a}
  }
  p 2
else
  p -1
end
0