結果

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

ソースコード

diff #

N, T = map(int, input().split())
ts = list(map(int, input().split()))
K = int(input())
xs = list(map(lambda x: int(x)-1, input().split()))


def solve():
    s = set(xs)
    time = T
    cnt = 0
    for i, t in enumerate(ts, 1):
        # print(f'{i=} {t=} {time=} {cnt=}')
        if t >= time + cnt * 10: return -1

        if t >= time:
            d, m = divmod(t, 10)
            cnt -= d
            time += d * 10
            if t >= time:
                assert cnt > 0
                time += 10
                cnt -= 1

            assert t < time

        time -= t
        if i in s:
            cnt += 1

    return len(s) - cnt


ans = solve()
print(ans)
0