結果

問題 No.904 サメトロ
ユーザー takakintakakin
提出日時 2020-07-10 00:24:57
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 132 ms / 1,000 ms
コード長 388 bytes
コンパイル時間 264 ms
コンパイル使用メモリ 82,304 KB
実行使用メモリ 75,904 KB
最終ジャッジ日時 2024-04-17 06:39:43
合計ジャッジ時間 3,398 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 54 ms
60,672 KB
testcase_01 AC 54 ms
61,056 KB
testcase_02 AC 66 ms
62,592 KB
testcase_03 AC 57 ms
61,440 KB
testcase_04 AC 60 ms
62,848 KB
testcase_05 AC 49 ms
57,600 KB
testcase_06 AC 66 ms
64,768 KB
testcase_07 AC 59 ms
62,720 KB
testcase_08 AC 75 ms
65,920 KB
testcase_09 AC 46 ms
57,344 KB
testcase_10 AC 58 ms
61,440 KB
testcase_11 AC 60 ms
61,568 KB
testcase_12 AC 49 ms
58,624 KB
testcase_13 AC 59 ms
62,464 KB
testcase_14 AC 57 ms
61,440 KB
testcase_15 AC 49 ms
58,240 KB
testcase_16 AC 60 ms
62,208 KB
testcase_17 AC 47 ms
57,344 KB
testcase_18 AC 47 ms
57,728 KB
testcase_19 AC 57 ms
61,440 KB
testcase_20 AC 47 ms
57,728 KB
testcase_21 AC 58 ms
62,592 KB
testcase_22 AC 70 ms
64,128 KB
testcase_23 AC 58 ms
61,440 KB
testcase_24 AC 61 ms
61,824 KB
testcase_25 AC 46 ms
57,088 KB
testcase_26 AC 60 ms
61,824 KB
testcase_27 AC 132 ms
75,904 KB
testcase_28 AC 46 ms
57,216 KB
testcase_29 AC 47 ms
57,728 KB
testcase_30 AC 47 ms
57,088 KB
testcase_31 AC 46 ms
57,728 KB
testcase_32 AC 46 ms
57,344 KB
testcase_33 AC 46 ms
57,472 KB
testcase_34 AC 46 ms
57,344 KB
testcase_35 AC 52 ms
60,544 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input=lambda: sys.stdin.readline().rstrip()
n=int(input())
AB=[]
at,bt=0,0
for _ in range(n-1):
  a,b=map(int,input().split())
  AB.append((a,b))
  at+=a
  bt+=b

ans=0
for a in range(n*10000+1):
  b=a+at-bt
  if b<0 or a>bt:
    continue
  else:
    chk=True
    for i in range(1,n):
      if AB[i-1][0]>bt+b-AB[i-1][1]:
        chk=False
    if chk:
      ans+=1
print(ans)

0