結果

問題 No.185 和風
ユーザー quilt-tailsquilt-tails
提出日時 2016-11-03 01:36:21
言語 Ruby
(3.3.0)
結果
WA  
実行時間 -
コード長 188 bytes
コンパイル時間 58 ms
コンパイル使用メモリ 7,552 KB
実行使用メモリ 12,416 KB
最終ジャッジ日時 2024-05-03 21:17:05
合計ジャッジ時間 1,119 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 80 ms
12,160 KB
testcase_01 AC 83 ms
12,416 KB
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 AC 79 ms
12,032 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.rb:6: warning: ambiguous first argument; put parentheses or a space even after `-' operator
Syntax OK

ソースコード

diff #

n = gets.to_i
diff = []
n.times do
  a, b = gets.split.map(&:to_i)
  if a > b
    puts -1
    break
  else
    diff << b - a
  end
end
puts diff.uniq.min == diff.uniq.max ? diff.first : -1
0