結果

問題 No.185 和風
ユーザー HachimoriHachimori
提出日時 2015-04-19 23:27:09
言語 Python2
(2.7.18)
結果
AC  
実行時間 15 ms / 1,000 ms
コード長 461 bytes
コンパイル時間 149 ms
コンパイル使用メモリ 6,704 KB
実行使用メモリ 6,372 KB
最終ジャッジ日時 2023-09-18 01:20:13
合計ジャッジ時間 825 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 13 ms
6,164 KB
testcase_01 AC 15 ms
6,372 KB
testcase_02 AC 14 ms
6,200 KB
testcase_03 AC 14 ms
6,348 KB
testcase_04 AC 14 ms
6,228 KB
testcase_05 AC 11 ms
6,072 KB
testcase_06 AC 14 ms
6,204 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#!/usr/bin/env python
#coding:utf8

def read():
    xyList = []
    for i in range(input()):
        xyList.append(map(int, raw_input().split()))
    return xyList


def work(xyList):
    ans = -1
    for (x, y) in xyList:
        if x >= y:
            print -1
            return
        elif ans != -1 and ans != y - x:
            print -1
            return
        else:
            ans = y - x
    print ans


if __name__ == "__main__":
    work(read())
0