結果

問題 No.185 和風
ユーザー maimai
提出日時 2016-01-29 12:33:30
言語 Ruby
(3.3.0)
結果
AC  
実行時間 94 ms / 1,000 ms
コード長 218 bytes
コンパイル時間 49 ms
コンパイル使用メモリ 11,916 KB
実行使用メモリ 16,104 KB
最終ジャッジ日時 2023-10-21 16:34:54
合計ジャッジ時間 1,349 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 93 ms
16,104 KB
testcase_01 AC 94 ms
16,104 KB
testcase_02 AC 87 ms
16,104 KB
testcase_03 AC 85 ms
16,104 KB
testcase_04 AC 86 ms
16,104 KB
testcase_05 AC 86 ms
16,104 KB
testcase_06 AC 87 ms
16,104 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
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

ソースコード

diff #

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]
0