結果

問題 No.185 和風
ユーザー itokoi4
提出日時 2025-06-22 13:28:58
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 55 ms / 1,000 ms
コード長 271 bytes
コンパイル時間 452 ms
コンパイル使用メモリ 82,360 KB
実行使用メモリ 63,144 KB
最終ジャッジ日時 2025-06-22 13:28:59
合計ジャッジ時間 1,423 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 7
権限があれば一括ダウンロードができます

ソースコード

diff #

n=int(input())
ans=None
for i in range(n):
    x,y=map(int,input().split())
    if ans:
        if ans==y-x:
            continue
        print(-1)
        exit()
    else:
        ans=y-x
        if ans>0:
            continue
        print(-1)
        exit()
print(ans)
0