結果
| 問題 |
No.3067 +10 Seconds Clock
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2025-03-21 21:56:41 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 796 bytes |
| コンパイル時間 | 307 ms |
| コンパイル使用メモリ | 82,400 KB |
| 実行使用メモリ | 77,640 KB |
| 最終ジャッジ日時 | 2025-03-21 21:56:52 |
| 合計ジャッジ時間 | 5,647 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge6 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 11 TLE * 1 -- * 11 |
ソースコード
import sys, time, random
from collections import deque, Counter, defaultdict
def debug(*x):print('debug:',*x, file=sys.stderr)
input = lambda: sys.stdin.readline().rstrip()
ii = lambda: int(input())
mi = lambda: map(int, input().split())
li = lambda: list(mi())
inf = 2 ** 61 - 1
mod = 998244353
n, t = mi()
d = li()
k = ii()
x = li()
clock = [0] * n
for i in range(k):
clock[x[i] - 1] += 1
dp = [-inf] * (k + 1)
dp[0] = t
for i in range(n - 1):
e = [-inf] * (k + 1)
for j in range(k + 1):
if dp[j] <= 0: continue
e[j] = max(e[j], dp[j] - d[i])
if j < k and clock[i]:
e[j + 1] = max(e[j + 1], dp[j] - d[i] + 10)
dp = e
ans = -1
for i in range(0, k + 1):
if dp[i] > 0:
ans = i
break
print(ans)