結果

問題 No.3468 あるジャッジサーバー
コンテスト
ユーザー 👑 loop0919
提出日時 2026-03-06 22:50:27
言語 PyPy3
(7.3.17)
コンパイル:
pypy3 -mpy_compile _filename_
実行:
pypy3 _filename_
結果
AC  
実行時間 50 ms / 2,000 ms
コード長 442 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 291 ms
コンパイル使用メモリ 85,404 KB
実行使用メモリ 65,968 KB
最終ジャッジ日時 2026-03-06 22:50:36
合計ジャッジ時間 1,542 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 16
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

from heapq import heapify, heappop, heappush

N = int(input())
T = [int(s) for s in input().split()]
S = [int(s) for s in input().split()]

pq = [(s, i) for i, s in enumerate(S)]
heapify(pq)

ans = 0
is_proceed = False

while pq:
    time, idx = heappop(pq)

    if idx == -1:
        is_proceed = False
        continue

    if not is_proceed:
        is_proceed = True
        heappush(pq, (time + T[idx], -1))
        ans += 1

print(ans)
0