結果

問題 No.185 和風
ユーザー dangodango
提出日時 2023-06-05 16:30:26
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 19 ms / 1,000 ms
コード長 421 bytes
コンパイル時間 110 ms
コンパイル使用メモリ 10,848 KB
実行使用メモリ 8,252 KB
最終ジャッジ日時 2023-08-28 09:38:14
合計ジャッジ時間 984 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 18 ms
7,852 KB
testcase_01 AC 19 ms
8,232 KB
testcase_02 AC 19 ms
8,216 KB
testcase_03 AC 18 ms
8,184 KB
testcase_04 AC 18 ms
8,252 KB
testcase_05 AC 15 ms
7,804 KB
testcase_06 AC 17 ms
8,180 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def CHECK(N, XYS):
  if XYS[0][0] >= XYS[0][1]:
    return False
  S = XYS[0][1] - XYS[0][0]
  for I in range(1, N):
    if XYS[I][0] > XYS[I][1]:
      return False
    else:
      if S != (XYS[I][1] - XYS[I][0]):
        return False
  return True
N = int(input())
XYS = []
for _ in range(N):
  Xi, Yi = map(int, input().split())
  XYS.append([Xi, Yi])
if CHECK(N, XYS):
  print(XYS[0][1] - XYS[0][0])
else:
  print(-1)
0