提出 #48856860


ソースコード 拡げる

import sys
input = sys.stdin.readline
from collections import defaultdict
from heapq import heappush, heappop, heapify

def main() -> None:
    N = int(input())
    dp = defaultdict(lambda: 0)
    mod = 998244353
    dp[1] = 1
    q = [1]
    heapify(q)
    s = set()
    s.add(1)
    while q:
        v = heappop(q)
        for i in range(2, 7):
            if v * i > N:
                break
            dp[v * i] += dp[v] * pow(5, -1, mod)
            dp[v * i] %= mod
            if v * i not in s:
                s.add(v * i)
                heappush(q, v * i)
    print(dp[N])


if __name__ == "__main__":
    main()

提出情報

提出日時
問題 E - Dice Product 3
ユーザ ryusuke_h
言語 Python (Cython 0.29.34)
得点 500
コード長 652 Byte
結果 AC
実行時間 56 ms
メモリ 11600 KiB

ジャッジ結果

セット名 Sample All
得点 / 配点 0 / 0 500 / 500
結果
AC × 4
AC × 25
セット名 テストケース
Sample 00_sample_00.txt, 00_sample_01.txt, 00_sample_02.txt, 00_sample_03.txt
All 00_sample_00.txt, 00_sample_01.txt, 00_sample_02.txt, 00_sample_03.txt, 01_small_00.txt, 01_small_01.txt, 01_small_02.txt, 01_small_03.txt, 01_small_04.txt, 01_small_05.txt, 01_small_06.txt, 01_small_07.txt, 02_random_00.txt, 02_random_01.txt, 02_random_02.txt, 02_random_03.txt, 02_random_04.txt, 02_random_05.txt, 02_random_06.txt, 03_limited_00.txt, 03_limited_01.txt, 03_limited_02.txt, 03_limited_03.txt, 03_limited_04.txt, 03_limited_05.txt
ケース名 結果 実行時間 メモリ
00_sample_00.txt AC 13 ms 9464 KiB
00_sample_01.txt AC 13 ms 9328 KiB
00_sample_02.txt AC 13 ms 9384 KiB
00_sample_03.txt AC 56 ms 11552 KiB
01_small_00.txt AC 12 ms 9456 KiB
01_small_01.txt AC 13 ms 9368 KiB
01_small_02.txt AC 13 ms 9392 KiB
01_small_03.txt AC 13 ms 9344 KiB
01_small_04.txt AC 13 ms 9436 KiB
01_small_05.txt AC 13 ms 9368 KiB
01_small_06.txt AC 13 ms 9356 KiB
01_small_07.txt AC 13 ms 9356 KiB
02_random_00.txt AC 56 ms 11452 KiB
02_random_01.txt AC 48 ms 11164 KiB
02_random_02.txt AC 55 ms 11500 KiB
02_random_03.txt AC 52 ms 11536 KiB
02_random_04.txt AC 54 ms 11528 KiB
02_random_05.txt AC 56 ms 11600 KiB
02_random_06.txt AC 53 ms 11492 KiB
03_limited_00.txt AC 53 ms 11460 KiB
03_limited_01.txt AC 53 ms 11476 KiB
03_limited_02.txt AC 55 ms 11600 KiB
03_limited_03.txt AC 52 ms 11488 KiB
03_limited_04.txt AC 55 ms 11428 KiB
03_limited_05.txt AC 53 ms 11464 KiB