結果

問題 No.185 和風
ユーザー mkawa2mkawa2
提出日時 2019-12-19 22:21:44
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 23 ms / 1,000 ms
コード長 535 bytes
コンパイル時間 70 ms
コンパイル使用メモリ 10,740 KB
実行使用メモリ 8,976 KB
最終ジャッジ日時 2023-09-21 07:31:11
合計ジャッジ時間 832 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 23 ms
8,968 KB
testcase_01 AC 23 ms
8,976 KB
testcase_02 AC 22 ms
8,828 KB
testcase_03 AC 21 ms
8,836 KB
testcase_04 AC 20 ms
8,920 KB
testcase_05 AC 20 ms
8,868 KB
testcase_06 AC 21 ms
8,936 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from decimal import *
import sys

sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep="\n")
def MI(): return map(int, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]

def main():
    n=int(input())
    x,y=MI()
    d=y-x
    if d<=0:
        print(-1)
        exit()
    for _ in range(n-1):
        x,y=MI()
        if y-x!=d:
            print(-1)
            exit()
    print(d)

main()
0