結果

問題 No.904 サメトロ
ユーザー takakintakakin
提出日時 2020-07-10 00:24:36
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
TLE  
実行時間 -
コード長 388 bytes
コンパイル時間 77 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 16,256 KB
最終ジャッジ日時 2024-04-17 06:39:09
合計ジャッジ時間 9,369 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 149 ms
16,256 KB
testcase_01 AC 53 ms
10,752 KB
testcase_02 AC 423 ms
10,624 KB
testcase_03 AC 108 ms
10,752 KB
testcase_04 AC 426 ms
10,752 KB
testcase_05 AC 50 ms
10,752 KB
testcase_06 AC 711 ms
10,624 KB
testcase_07 AC 102 ms
10,752 KB
testcase_08 TLE -
testcase_09 AC 42 ms
10,624 KB
testcase_10 AC 180 ms
10,752 KB
testcase_11 AC 185 ms
10,752 KB
testcase_12 AC 82 ms
10,624 KB
testcase_13 AC 65 ms
10,752 KB
testcase_14 AC 98 ms
10,624 KB
testcase_15 AC 100 ms
10,624 KB
testcase_16 AC 205 ms
10,752 KB
testcase_17 AC 66 ms
10,752 KB
testcase_18 AC 41 ms
10,752 KB
testcase_19 AC 80 ms
10,624 KB
testcase_20 AC 65 ms
10,752 KB
testcase_21 AC 138 ms
10,752 KB
testcase_22 AC 913 ms
10,752 KB
testcase_23 AC 157 ms
10,752 KB
testcase_24 AC 298 ms
10,752 KB
testcase_25 AC 39 ms
10,752 KB
testcase_26 AC 217 ms
10,752 KB
testcase_27 TLE -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
testcase_33 -- -
testcase_34 -- -
testcase_35 -- -
権限があれば一括ダウンロードができます

ソースコード

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