結果

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

ソースコード

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 = -1, MUSIC_TOTAL
    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