結果
| 問題 |
No.561 東京と京都
|
| コンテスト | |
| ユーザー |
URechaRecha
|
| 提出日時 | 2019-09-03 20:52:20 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 801 bytes |
| コンパイル時間 | 169 ms |
| コンパイル使用メモリ | 12,672 KB |
| 実行使用メモリ | 71,680 KB |
| 最終ジャッジ日時 | 2024-12-24 15:19:49 |
| 合計ジャッジ時間 | 31,626 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 7 TLE * 10 |
ソースコード
def tokyo_and_kyoto(inp=None):
if inp == None:
n,d= map(int,input().split())
inp_l = []
for _ in range(n):
inp_l.append(input())
else:
inp_l = inp.split("\n")
n, d = map(int,inp_l.pop(0).split())
heap = [[[0],0]]
for _ in range(n):
l = len(heap)
a, b = map(int, inp_l.pop(0).split())
for _ in range(l):
path, money =heap.pop(0)
if path[-1] == 0:
heap.append([path+[0],money+a])
heap.append([path+[1],money+b-d])
else:
heap.append([path+[0],money+a-d])
heap.append([path+[1],money+b])
heap.sort(key= lambda x:x[1],reverse=True)
return heap[0][1]
if __name__ == "__main__":
print(tokyo_and_kyoto())
URechaRecha