結果

問題 No.1885 Flat Permutation
ユーザー titiatitia
提出日時 2022-03-25 22:04:27
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 125 ms / 2,000 ms
コード長 341 bytes
コンパイル時間 403 ms
コンパイル使用メモリ 10,960 KB
実行使用メモリ 19,980 KB
最終ジャッジ日時 2023-08-04 08:57:31
合計ジャッジ時間 7,799 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 116 ms
19,952 KB
testcase_01 AC 117 ms
19,968 KB
testcase_02 AC 113 ms
19,816 KB
testcase_03 AC 114 ms
19,940 KB
testcase_04 AC 112 ms
19,920 KB
testcase_05 AC 115 ms
19,740 KB
testcase_06 AC 116 ms
19,848 KB
testcase_07 AC 114 ms
19,820 KB
testcase_08 AC 117 ms
19,788 KB
testcase_09 AC 112 ms
19,804 KB
testcase_10 AC 115 ms
19,744 KB
testcase_11 AC 117 ms
19,820 KB
testcase_12 AC 116 ms
19,772 KB
testcase_13 AC 119 ms
19,872 KB
testcase_14 AC 121 ms
19,944 KB
testcase_15 AC 114 ms
19,840 KB
testcase_16 AC 117 ms
19,816 KB
testcase_17 AC 119 ms
19,912 KB
testcase_18 AC 119 ms
19,944 KB
testcase_19 AC 120 ms
19,976 KB
testcase_20 AC 118 ms
19,956 KB
testcase_21 AC 118 ms
19,796 KB
testcase_22 AC 125 ms
19,940 KB
testcase_23 AC 125 ms
19,980 KB
testcase_24 AC 125 ms
19,852 KB
testcase_25 AC 123 ms
19,976 KB
testcase_26 AC 120 ms
19,892 KB
testcase_27 AC 123 ms
19,972 KB
testcase_28 AC 116 ms
19,952 KB
testcase_29 AC 117 ms
19,976 KB
testcase_30 AC 125 ms
19,820 KB
testcase_31 AC 124 ms
19,972 KB
testcase_32 AC 124 ms
19,844 KB
testcase_33 AC 120 ms
19,852 KB
testcase_34 AC 121 ms
19,704 KB
testcase_35 AC 120 ms
19,900 KB
testcase_36 AC 116 ms
19,968 KB
testcase_37 AC 124 ms
19,964 KB
testcase_38 AC 114 ms
19,808 KB
testcase_39 AC 118 ms
19,852 KB
testcase_40 AC 116 ms
19,768 KB
testcase_41 AC 119 ms
19,824 KB
testcase_42 AC 117 ms
19,944 KB
testcase_43 AC 115 ms
19,852 KB
testcase_44 AC 121 ms
19,848 KB
testcase_45 AC 120 ms
19,900 KB
testcase_46 AC 119 ms
19,916 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N,X,Y=map(int,input().split())
mod=998244353

DP=[0]*(3*10**5)

DP[0]=1

for i in range(1,3*10**5):
    DP[i]=(DP[i-1]+DP[i-3])%mod

k=abs(X-Y)

if X==1 and Y==N:
    print(DP[k])
elif Y==1 and X==N:
    print(DP[k])
elif X==1 or Y==1 or X==N or Y==N:
    print(DP[k-1])
else:
    if k-2<0:
        print(0)
    else:
        print(DP[k-2])
0