結果

問題 No.1885 Flat Permutation
ユーザー とりゐとりゐ
提出日時 2022-03-25 21:36:34
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 81 ms / 2,000 ms
コード長 264 bytes
コンパイル時間 778 ms
コンパイル使用メモリ 86,704 KB
実行使用メモリ 77,788 KB
最終ジャッジ日時 2023-08-04 08:26:41
合計ジャッジ時間 5,600 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 75 ms
71,296 KB
testcase_01 AC 75 ms
71,396 KB
testcase_02 AC 75 ms
71,280 KB
testcase_03 AC 76 ms
75,904 KB
testcase_04 AC 71 ms
71,512 KB
testcase_05 AC 73 ms
71,224 KB
testcase_06 AC 72 ms
71,024 KB
testcase_07 AC 71 ms
71,540 KB
testcase_08 AC 72 ms
71,260 KB
testcase_09 AC 71 ms
71,180 KB
testcase_10 AC 70 ms
71,456 KB
testcase_11 AC 72 ms
71,292 KB
testcase_12 AC 75 ms
71,188 KB
testcase_13 AC 73 ms
71,212 KB
testcase_14 AC 73 ms
71,320 KB
testcase_15 AC 72 ms
71,324 KB
testcase_16 AC 72 ms
71,292 KB
testcase_17 AC 72 ms
71,144 KB
testcase_18 AC 73 ms
71,188 KB
testcase_19 AC 79 ms
77,712 KB
testcase_20 AC 78 ms
77,788 KB
testcase_21 AC 80 ms
77,508 KB
testcase_22 AC 78 ms
77,348 KB
testcase_23 AC 72 ms
71,492 KB
testcase_24 AC 73 ms
71,180 KB
testcase_25 AC 72 ms
71,544 KB
testcase_26 AC 73 ms
71,172 KB
testcase_27 AC 81 ms
77,740 KB
testcase_28 AC 80 ms
77,748 KB
testcase_29 AC 79 ms
77,736 KB
testcase_30 AC 79 ms
77,740 KB
testcase_31 AC 81 ms
77,464 KB
testcase_32 AC 74 ms
71,048 KB
testcase_33 AC 73 ms
71,436 KB
testcase_34 AC 73 ms
71,348 KB
testcase_35 AC 81 ms
77,508 KB
testcase_36 AC 79 ms
77,568 KB
testcase_37 AC 73 ms
71,348 KB
testcase_38 AC 73 ms
71,252 KB
testcase_39 AC 73 ms
71,052 KB
testcase_40 AC 78 ms
76,192 KB
testcase_41 AC 78 ms
76,856 KB
testcase_42 AC 78 ms
75,972 KB
testcase_43 AC 79 ms
77,636 KB
testcase_44 AC 81 ms
77,492 KB
testcase_45 AC 79 ms
77,692 KB
testcase_46 AC 80 ms
77,704 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n,x,y=map(int,input().split())
x,y=min(x,y),max(x,y)
d=y-x-1

if x==1:
  d+=1
if y==n:
  d+=1

if d<=0:
  print(0)
  exit()

mod=998244353
dp=[0]*d
dp[0]=1
for i in range(1,d):
  dp[i]+=dp[i-1]
  if i-3>=0:
    dp[i]+=dp[i-3]
  dp[i]%=mod

print(dp[-1])
#print(dp)
0