結果

問題 No.1885 Flat Permutation
ユーザー k_o_pasturek_o_pasture
提出日時 2022-03-25 22:58:20
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 127 ms / 2,000 ms
コード長 336 bytes
コンパイル時間 453 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 18,688 KB
最終ジャッジ日時 2024-04-22 07:48:22
合計ジャッジ時間 4,212 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 30 ms
10,752 KB
testcase_01 AC 30 ms
10,752 KB
testcase_02 AC 30 ms
10,880 KB
testcase_03 AC 33 ms
10,880 KB
testcase_04 AC 30 ms
10,752 KB
testcase_05 AC 30 ms
10,752 KB
testcase_06 AC 30 ms
10,880 KB
testcase_07 AC 30 ms
10,752 KB
testcase_08 AC 31 ms
10,880 KB
testcase_09 AC 30 ms
10,752 KB
testcase_10 AC 30 ms
10,880 KB
testcase_11 AC 30 ms
10,752 KB
testcase_12 AC 30 ms
10,752 KB
testcase_13 AC 30 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,880 KB
testcase_18 AC 30 ms
10,752 KB
testcase_19 AC 126 ms
18,688 KB
testcase_20 AC 124 ms
18,688 KB
testcase_21 AC 123 ms
18,688 KB
testcase_22 AC 116 ms
17,920 KB
testcase_23 AC 30 ms
10,752 KB
testcase_24 AC 30 ms
10,752 KB
testcase_25 AC 30 ms
10,880 KB
testcase_26 AC 30 ms
10,752 KB
testcase_27 AC 123 ms
18,688 KB
testcase_28 AC 122 ms
18,560 KB
testcase_29 AC 127 ms
18,688 KB
testcase_30 AC 124 ms
18,688 KB
testcase_31 AC 123 ms
18,688 KB
testcase_32 AC 30 ms
10,880 KB
testcase_33 AC 30 ms
10,752 KB
testcase_34 AC 30 ms
10,752 KB
testcase_35 AC 122 ms
18,688 KB
testcase_36 AC 124 ms
18,688 KB
testcase_37 AC 30 ms
10,752 KB
testcase_38 AC 30 ms
10,752 KB
testcase_39 AC 29 ms
10,752 KB
testcase_40 AC 46 ms
12,160 KB
testcase_41 AC 68 ms
14,208 KB
testcase_42 AC 37 ms
11,392 KB
testcase_43 AC 127 ms
18,688 KB
testcase_44 AC 122 ms
18,688 KB
testcase_45 AC 123 ms
18,688 KB
testcase_46 AC 122 ms
18,688 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N, X, Y = map(int, input().split())
if Y < X:
	X, Y = Y, X
mod = 998244353
if Y - X == 1:
	if X != 1 and Y != N:
		print(0)
		exit()
if X != 1:
	X += 1
if Y != N:
	Y -= 1

L = Y-X + 1
# print('L',L)
if L <= 2:
	print(1)
	exit()
dp = [1 for _ in range(L)]
for l in range(3, L):
	# print(l)
	dp[l] = (dp[l-3] + dp[l-1])%mod
print(dp[L-1])
0