結果

問題 No.1885 Flat Permutation
ユーザー lloyzlloyz
提出日時 2022-03-26 00:11:35
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 218 ms / 2,000 ms
コード長 397 bytes
コンパイル時間 282 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 18,816 KB
最終ジャッジ日時 2024-04-22 09:19:21
合計ジャッジ時間 5,789 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 30 ms
10,752 KB
testcase_01 AC 31 ms
10,880 KB
testcase_02 AC 30 ms
10,752 KB
testcase_03 AC 35 ms
10,880 KB
testcase_04 AC 30 ms
10,752 KB
testcase_05 AC 30 ms
10,880 KB
testcase_06 AC 30 ms
10,880 KB
testcase_07 AC 30 ms
10,752 KB
testcase_08 AC 31 ms
10,752 KB
testcase_09 AC 33 ms
10,752 KB
testcase_10 AC 30 ms
10,880 KB
testcase_11 AC 30 ms
10,752 KB
testcase_12 AC 31 ms
10,752 KB
testcase_13 AC 31 ms
10,880 KB
testcase_14 AC 30 ms
10,752 KB
testcase_15 AC 30 ms
10,880 KB
testcase_16 AC 30 ms
10,752 KB
testcase_17 AC 30 ms
10,752 KB
testcase_18 AC 32 ms
10,752 KB
testcase_19 AC 217 ms
18,688 KB
testcase_20 AC 206 ms
18,688 KB
testcase_21 AC 203 ms
18,688 KB
testcase_22 AC 186 ms
17,920 KB
testcase_23 AC 30 ms
10,880 KB
testcase_24 AC 30 ms
10,752 KB
testcase_25 AC 31 ms
10,752 KB
testcase_26 AC 31 ms
10,752 KB
testcase_27 AC 209 ms
18,688 KB
testcase_28 AC 206 ms
18,688 KB
testcase_29 AC 213 ms
18,688 KB
testcase_30 AC 206 ms
18,816 KB
testcase_31 AC 209 ms
18,688 KB
testcase_32 AC 31 ms
10,752 KB
testcase_33 AC 31 ms
10,752 KB
testcase_34 AC 30 ms
10,880 KB
testcase_35 AC 208 ms
18,560 KB
testcase_36 AC 206 ms
18,560 KB
testcase_37 AC 31 ms
10,752 KB
testcase_38 AC 31 ms
10,752 KB
testcase_39 AC 30 ms
10,752 KB
testcase_40 AC 64 ms
12,160 KB
testcase_41 AC 107 ms
14,208 KB
testcase_42 AC 44 ms
11,264 KB
testcase_43 AC 212 ms
18,688 KB
testcase_44 AC 205 ms
18,688 KB
testcase_45 AC 210 ms
18,688 KB
testcase_46 AC 218 ms
18,688 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n, x, y = map(int, input().split())
mod = 998244353

if x > y:
    x, y = y, x

if x > 1:
    x += 1
if y < n:
    y -= 1
dif = y - x
if dif < 0:
    print(0)
else:
    DP = [0 for _ in range(dif + 1)]
    DP[0] = 1
    for i in range(dif):
        DP[i + 1] += DP[i]
        DP[i + 1] %= mod
        if i + 3 <= dif:
            DP[i + 3] += DP[i]
            DP[i + 3] %= mod
    print(DP[dif])
0