結果

問題 No.1885 Flat Permutation
ユーザー simansiman
提出日時 2022-05-12 17:40:08
言語 Ruby
(3.3.0)
結果
WA  
実行時間 -
コード長 265 bytes
コンパイル時間 606 ms
コンパイル使用メモリ 11,200 KB
実行使用メモリ 16,852 KB
最終ジャッジ日時 2023-09-27 17:14:39
合計ジャッジ時間 9,880 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 80 ms
15,016 KB
testcase_01 AC 80 ms
15,096 KB
testcase_02 WA -
testcase_03 AC 80 ms
15,304 KB
testcase_04 AC 81 ms
15,128 KB
testcase_05 AC 81 ms
15,140 KB
testcase_06 AC 79 ms
15,208 KB
testcase_07 AC 79 ms
15,268 KB
testcase_08 AC 78 ms
15,024 KB
testcase_09 AC 79 ms
15,168 KB
testcase_10 AC 80 ms
15,300 KB
testcase_11 AC 81 ms
15,220 KB
testcase_12 AC 82 ms
15,216 KB
testcase_13 AC 80 ms
15,236 KB
testcase_14 AC 80 ms
15,164 KB
testcase_15 AC 82 ms
15,268 KB
testcase_16 AC 81 ms
15,268 KB
testcase_17 AC 80 ms
15,264 KB
testcase_18 AC 81 ms
15,216 KB
testcase_19 AC 128 ms
16,596 KB
testcase_20 AC 126 ms
16,600 KB
testcase_21 AC 127 ms
16,728 KB
testcase_22 AC 122 ms
16,516 KB
testcase_23 AC 81 ms
15,220 KB
testcase_24 AC 81 ms
15,016 KB
testcase_25 WA -
testcase_26 AC 80 ms
15,032 KB
testcase_27 AC 127 ms
16,608 KB
testcase_28 AC 126 ms
16,800 KB
testcase_29 AC 126 ms
16,744 KB
testcase_30 AC 126 ms
16,600 KB
testcase_31 AC 127 ms
16,712 KB
testcase_32 AC 80 ms
15,068 KB
testcase_33 AC 81 ms
15,196 KB
testcase_34 WA -
testcase_35 AC 128 ms
16,852 KB
testcase_36 AC 127 ms
16,724 KB
testcase_37 AC 83 ms
15,052 KB
testcase_38 WA -
testcase_39 WA -
testcase_40 AC 87 ms
15,548 KB
testcase_41 AC 100 ms
15,872 KB
testcase_42 AC 84 ms
15,192 KB
testcase_43 AC 125 ms
16,592 KB
testcase_44 AC 124 ms
16,720 KB
testcase_45 AC 126 ms
16,612 KB
testcase_46 AC 126 ms
16,688 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

N, x, y = gets.split.map(&:to_i)
MOD = 998_244_353

if x > y
  x, y = y, x
end

x += 1 if x != 1
y -= 1 if y != N

d = y - x
dp = Array.new(d + 1, 0)
dp[0] = 1

1.upto(d) do |i|
  dp[i] += dp[i - 1]
  dp[i] += dp[i - 3] if i - 3 >= 0
  dp[i] %= MOD
end

puts dp[d]
0