結果

問題 No.1885 Flat Permutation
ユーザー titiatitia
提出日時 2022-03-25 22:04:27
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 171 ms / 2,000 ms
コード長 341 bytes
コンパイル時間 187 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 22,528 KB
最終ジャッジ日時 2024-04-22 06:45:09
合計ジャッジ時間 9,158 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 169 ms
22,272 KB
testcase_01 AC 171 ms
22,272 KB
testcase_02 AC 163 ms
22,272 KB
testcase_03 AC 165 ms
22,272 KB
testcase_04 AC 158 ms
22,400 KB
testcase_05 AC 161 ms
22,272 KB
testcase_06 AC 164 ms
22,400 KB
testcase_07 AC 163 ms
22,272 KB
testcase_08 AC 157 ms
22,272 KB
testcase_09 AC 158 ms
22,272 KB
testcase_10 AC 159 ms
22,272 KB
testcase_11 AC 159 ms
22,272 KB
testcase_12 AC 157 ms
22,400 KB
testcase_13 AC 161 ms
22,272 KB
testcase_14 AC 158 ms
22,528 KB
testcase_15 AC 165 ms
22,272 KB
testcase_16 AC 160 ms
22,272 KB
testcase_17 AC 160 ms
22,272 KB
testcase_18 AC 164 ms
22,400 KB
testcase_19 AC 159 ms
22,272 KB
testcase_20 AC 159 ms
22,400 KB
testcase_21 AC 163 ms
22,272 KB
testcase_22 AC 163 ms
22,400 KB
testcase_23 AC 158 ms
22,272 KB
testcase_24 AC 157 ms
22,400 KB
testcase_25 AC 157 ms
22,400 KB
testcase_26 AC 158 ms
22,400 KB
testcase_27 AC 158 ms
22,400 KB
testcase_28 AC 169 ms
22,272 KB
testcase_29 AC 156 ms
22,400 KB
testcase_30 AC 158 ms
22,400 KB
testcase_31 AC 157 ms
22,400 KB
testcase_32 AC 157 ms
22,528 KB
testcase_33 AC 158 ms
22,400 KB
testcase_34 AC 158 ms
22,272 KB
testcase_35 AC 159 ms
22,400 KB
testcase_36 AC 159 ms
22,272 KB
testcase_37 AC 160 ms
22,400 KB
testcase_38 AC 165 ms
22,400 KB
testcase_39 AC 168 ms
22,400 KB
testcase_40 AC 159 ms
22,528 KB
testcase_41 AC 161 ms
22,400 KB
testcase_42 AC 157 ms
22,400 KB
testcase_43 AC 159 ms
22,400 KB
testcase_44 AC 157 ms
22,400 KB
testcase_45 AC 159 ms
22,272 KB
testcase_46 AC 159 ms
22,400 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