結果

問題 No.3325 陰陽師
コンテスト
ユーザー 高橋ゆに
提出日時 2025-07-20 17:31:13
言語 PyPy3
(7.3.15)
結果
WA  
(最新)
AC  
(最初)
実行時間 -
コード長 787 bytes
コンパイル時間 252 ms
コンパイル使用メモリ 82,572 KB
実行使用メモリ 158,500 KB
最終ジャッジ日時 2025-11-01 02:53:16
合計ジャッジ時間 10,257 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other WA * 30
権限があれば一括ダウンロードができます

ソースコード

diff #

PROBLEM_TOTAL, MUSIC_TOTAL = map(int, input().split())
TIMES = list(map(int, input().split()))
TIME_LIMITS = list(map(int, input().split()))

def main():
    TIMES.sort(reverse = True)
    
    ok, ng = 0, MUSIC_TOTAL + 1
    while abs(ok - ng) > 1:
        med = (ok + ng) // 2
        if judge(med):
            ok = med
        else:
            ng = med
    
    print(ok)

def judge(x):
    if x == 0:
        return True
  
    sub_time_limits = TIME_LIMITS[:x]
    sub_time_limits.sort(reverse = True)
        
    music_i = 0
    for time in TIMES:
        time_limit = sub_time_limits[music_i]
        if time <= time_limit:
            music_i += 1
            if music_i >= x:
                 break
        
    return music_i >= x
    
if __name__ == "__main__":
    main()
0