結果

問題 No.185 和風
ユーザー wonda_t_coffeewonda_t_coffee
提出日時 2020-01-29 10:08:10
言語 Ruby
(3.3.0)
結果
AC  
実行時間 77 ms / 1,000 ms
コード長 195 bytes
コンパイル時間 247 ms
コンパイル使用メモリ 11,484 KB
実行使用メモリ 15,288 KB
最終ジャッジ日時 2023-10-14 05:07:48
合計ジャッジ時間 2,176 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 72 ms
15,288 KB
testcase_01 AC 74 ms
15,100 KB
testcase_02 AC 77 ms
15,132 KB
testcase_03 AC 73 ms
15,200 KB
testcase_04 AC 73 ms
15,136 KB
testcase_05 AC 72 ms
15,144 KB
testcase_06 AC 75 ms
15,092 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

n = gets.chomp.to_i
a = []
f = false
n.times do
  x, y = gets.chomp.split.map(&:to_i)
  if x >= y
    f = true
    next
  else
    a << y - x
  end
end
puts f ? -1 : a.uniq.size == 1 ? a[0] : -1
0