結果
| 問題 |
No.185 和風
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2016-01-29 12:33:30 |
| 言語 | Ruby (3.4.1) |
| 結果 |
AC
|
| 実行時間 | 92 ms / 1,000 ms |
| コード長 | 218 bytes |
| コンパイル時間 | 46 ms |
| コンパイル使用メモリ | 7,680 KB |
| 実行使用メモリ | 12,288 KB |
| 最終ジャッジ日時 | 2024-09-21 17:51:11 |
| 合計ジャッジ時間 | 1,291 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 7 |
コンパイルメッセージ
Main.rb:8: warning: ambiguous first argument; put parentheses or a space even after `-' operator Main.rb:11: warning: ambiguous first argument; put parentheses or a space even after `-' operator Main.rb:1: warning: assigned but unused variable - n Syntax OK
ソースコード
n=gets.to_i
a=[]
while cin=gets
x,y=cin.split(" ").map(&:to_i)
a+=[y-x > 0 ? y-x : -1]
a.uniq!
if a.size>1
puts -1
exit
elsif a[0]==-1
puts -1
exit
end
end
p a[0]