結果

問題 No.3851 Dreams
コンテスト
ユーザー Nzt3
提出日時 2026-11-06 16:52:12
言語 PyPy3
(8.0.1 + ACL)
コンパイル:
pypy3 -mpy_compile _filename_
実行:
pypy3 _filename_
結果
AC  
実行時間 966 ms / 2,000 ms
+ 263µs
コード長 837 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 91 ms
コンパイル使用メモリ 64,220 KB
実行使用メモリ 59,584 KB
最終ジャッジ日時 2026-12-04 21:02:46
合計ジャッジ時間 13,445 ms
ジャッジサーバーID
(参考情報)
judge4_0 / judge1_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 25
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

MOD = 998244353
INV100 = pow(100, MOD - 2, MOD)


def main():
    N, _ = map(int, input().split())
    skills = []
    for _ in range(N):
        x, y, p, s = map(int, input().split())
        skills.append((x, y, p, s))
    skills.sort(key=lambda skill: skill[3], reverse=True)

    times = list(map(int, input().split()))
    answer = 0

    for t in times:
        no_higher_boost = 1
        for x, y, p, s in skills:
            count = t // x - max(0, t - y) // x
            if count > 0:
                no_active = pow((100 - p) * INV100 % MOD, count, MOD)
                answer += s * no_higher_boost * (1 - no_active)
                answer %= MOD
                no_higher_boost = no_higher_boost * no_active % MOD
        answer = (answer + no_higher_boost) % MOD

    print(answer)


if __name__ == "__main__":
    main()
0