結果

問題 No.3067 +10 Seconds Clock
ユーザー わん
提出日時 2025-03-31 00:27:03
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 151 ms / 2,000 ms
コード長 360 bytes
コンパイル時間 347 ms
コンパイル使用メモリ 82,404 KB
実行使用メモリ 113,560 KB
最終ジャッジ日時 2025-03-31 00:27:08
合計ジャッジ時間 4,002 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 23
権限があれば一括ダウンロードができます

ソースコード

diff #

N, T = map(int, input().split())
t = list(map(int, input().split()))
K = int(input())
x = list(map(int, input().split()))

items = 0
ans = 0
j = 0
for i in range(N-1):
  T -= t[i]
  
  while T <= 0 and items:
    T += 10
    items -= 1
    ans += 1
    
  if T <= 0:
    ans = -1
    break
  
  if j < K and x[j] == i+2:
    j += 1
    items += 1
  
print(ans)
0