結果

問題 No.185 和風
ユーザー LeonardoneLeonardone
提出日時 2015-10-17 02:10:05
言語 Ruby
(3.3.0)
結果
AC  
実行時間 86 ms / 1,000 ms
コード長 257 bytes
コンパイル時間 64 ms
コンパイル使用メモリ 11,520 KB
実行使用メモリ 15,244 KB
最終ジャッジ日時 2023-09-29 13:24:28
合計ジャッジ時間 1,481 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 86 ms
15,120 KB
testcase_01 AC 85 ms
15,180 KB
testcase_02 AC 81 ms
15,076 KB
testcase_03 AC 82 ms
15,204 KB
testcase_04 AC 81 ms
15,116 KB
testcase_05 AC 82 ms
15,156 KB
testcase_06 AC 85 ms
15,244 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

#! ruby
# yukicoder My Practice
# author: Leonardone @ NEETSDKASU

N = gets.to_i

m = Hash.new 0

N.times do
	x, y = gets.split.map(&:to_i)
	d = y - x
	if d <= 0
		puts '-1'
		exit
	end
	m[d] += 1
end

if m.keys.size > 1
	puts '-1'
	exit
end

puts m.keys[0]
0