結果
| 問題 |
No.3067 +10 Seconds Clock
|
| コンテスト | |
| ユーザー |
あじゃじゃ
|
| 提出日時 | 2025-03-21 22:21:08 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 1,064 bytes |
| コンパイル時間 | 433 ms |
| コンパイル使用メモリ | 82,360 KB |
| 実行使用メモリ | 81,300 KB |
| 最終ジャッジ日時 | 2025-03-21 22:21:15 |
| 合計ジャッジ時間 | 5,961 ms |
|
ジャッジサーバーID (参考情報) |
judge7 / judge6 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 11 TLE * 1 -- * 11 |
ソースコード
import sys
def main():
input = sys.stdin.readline
# 入力
N, T = map(int, input().split())
t = list(map(int, input().split()))
K=int(input())
bonus_nodes = set(map(int, input().split()))
dp = {0: T}
for i in range(1, N):
ndp = {}
cost = t[i-1]
for used, time_left in dp.items():
if time_left <= cost:
continue
rem = time_left - cost
if rem > ndp.get(used, -1):
ndp[used] = rem
if (i+1) in bonus_nodes and rem >= 1:
new_used = used + 1
new_time = rem + 10
if new_time > ndp.get(new_used, -1):
ndp[new_used] = new_time
dp = ndp
if not dp:
print("-1")
return
ans = None
for used, time_left in dp.items():
if time_left > 0:
if ans is None or used < ans:
ans = used
if ans is None:
print("-1")
else:
print(ans)
if __name__ == '__main__':
main()
あじゃじゃ