結果

問題 No.1885 Flat Permutation
ユーザー aaaaaaaaaa2230aaaaaaaaaa2230
提出日時 2022-03-25 23:00:15
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 625 bytes
コンパイル時間 449 ms
コンパイル使用メモリ 82,404 KB
実行使用メモリ 61,956 KB
最終ジャッジ日時 2024-04-22 07:50:40
合計ジャッジ時間 3,786 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 38 ms
52,740 KB
testcase_01 AC 39 ms
51,840 KB
testcase_02 AC 39 ms
52,568 KB
testcase_03 AC 43 ms
59,248 KB
testcase_04 AC 36 ms
52,880 KB
testcase_05 AC 36 ms
52,092 KB
testcase_06 WA -
testcase_07 AC 35 ms
53,912 KB
testcase_08 AC 36 ms
52,812 KB
testcase_09 AC 35 ms
52,508 KB
testcase_10 AC 34 ms
53,016 KB
testcase_11 WA -
testcase_12 WA -
testcase_13 AC 36 ms
52,232 KB
testcase_14 AC 36 ms
52,492 KB
testcase_15 WA -
testcase_16 AC 35 ms
52,144 KB
testcase_17 AC 36 ms
51,900 KB
testcase_18 AC 35 ms
53,652 KB
testcase_19 AC 43 ms
60,288 KB
testcase_20 AC 44 ms
60,660 KB
testcase_21 AC 43 ms
60,008 KB
testcase_22 AC 42 ms
60,656 KB
testcase_23 WA -
testcase_24 AC 35 ms
53,268 KB
testcase_25 AC 35 ms
52,360 KB
testcase_26 AC 36 ms
52,136 KB
testcase_27 AC 43 ms
61,956 KB
testcase_28 AC 42 ms
61,368 KB
testcase_29 AC 43 ms
61,808 KB
testcase_30 AC 43 ms
60,456 KB
testcase_31 AC 42 ms
61,348 KB
testcase_32 AC 36 ms
52,688 KB
testcase_33 AC 35 ms
52,484 KB
testcase_34 AC 35 ms
52,432 KB
testcase_35 AC 43 ms
61,296 KB
testcase_36 AC 43 ms
60,120 KB
testcase_37 AC 35 ms
53,112 KB
testcase_38 AC 39 ms
52,496 KB
testcase_39 AC 35 ms
52,236 KB
testcase_40 AC 41 ms
59,148 KB
testcase_41 AC 44 ms
60,148 KB
testcase_42 AC 41 ms
58,428 KB
testcase_43 AC 45 ms
59,988 KB
testcase_44 AC 43 ms
60,776 KB
testcase_45 AC 42 ms
61,108 KB
testcase_46 AC 44 ms
60,168 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n,x,y = map(int,input().split())
mod = 998244353

if x < y:
    start = x+1
    if x+1 == y:
        if y == n:
            print(1)
        else:
            print(0)
        exit()

    end = y-1

    dif = end-start

else:
    start = x-1
    if x-1 == y:
        if y == 1:
            print(1)
        else:
            print(0)
        exit()
    end = y+1
    dif = start-end

if y == 1 or y == n:
    dif += 1
if x == 1 or x == n:
    dif += 1
    
dp = [0]*(dif+1)
dp[0] = 1
for i in range(dif):
    dp[i+1] += dp[i]
    dp[i+1] %= mod
    if i+3 <= dif:
        dp[i+3] += dp[i]
        dp[i+3] %= mod
print(dp[-1])
0