結果

問題 No.2867 NOT FOUND 404 Again
コンテスト
ユーザー lmxyue
提出日時 2025-08-13 10:45:55
言語 PyPy3
(7.3.17)
コンパイル:
pypy3 -mpy_compile _filename_
実行:
pypy3 _filename_
結果
AC  
実行時間 1,261 ms / 3,000 ms
+ 580µs
コード長 556 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 237 ms
コンパイル使用メモリ 96,108 KB
実行使用メモリ 126,336 KB
最終ジャッジ日時 2026-07-14 00:05:31
合計ジャッジ時間 21,596 ms
ジャッジサーバーID
(参考情報)
judge3_0 / judge1_1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 18
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

N = list(map(int, input()))
D = len(N)
M = 4
now = [[0] * M for _ in range(2)]
now[0][0] = 1

for i, n in enumerate(N):
    nxt = [[0] * M for _ in range(2)]
    for smaller in range(2):
        for j in range(M-1):
            for x in range(10 if smaller else n + 1):
                cond = (j == 0 and x == 4) or (j == 1 and x == 0) or (j == 2 and x == 4)
                nxt[smaller or x < n][j+1 if cond else x == 4] += now[smaller][j]
    now = [[v % 998244353 for v in row] for row in nxt]

print((sum(now[0][:3]) + sum(now[1][:3]) - 1) % 998244353)
0