結果

問題 No.3067 +10 Seconds Clock
ユーザー Facade
提出日時 2025-03-21 21:42:43
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 142 ms / 2,000 ms
コード長 429 bytes
コンパイル時間 209 ms
コンパイル使用メモリ 82,948 KB
実行使用メモリ 124,036 KB
最終ジャッジ日時 2025-03-21 21:42:47
合計ジャッジ時間 3,469 ms
ジャッジサーバーID
(参考情報)
judge1 / judge6
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 23
権限があれば一括ダウンロードができます

ソースコード

diff #

n,rest=map(int,input().split())
t=list(map(int,input().split()))
k=int(input())
p=set(map(int,input().split()))
need=(sum(t)-rest+1+9)//10
if need>k:
    print(-1)
    exit()
cnt=0
for i in range(n-1):
    if rest>t[i]:
        rest-=t[i]
        if i+2 in p:
            rest+=10
            cnt+=1
            if cnt==need:
                print(need)
                exit()
    else:
        print(-1)
        exit()
print(0)
0