結果

問題 No.1885 Flat Permutation
ユーザー bonKotsubonKotsu
提出日時 2022-08-03 23:59:41
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 909 bytes
コンパイル時間 4,368 ms
コンパイル使用メモリ 262,272 KB
実行使用メモリ 14,320 KB
最終ジャッジ日時 2023-10-11 19:36:21
合計ジャッジ時間 8,509 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,368 KB
testcase_01 AC 2 ms
4,372 KB
testcase_02 AC 1 ms
4,368 KB
testcase_03 AC 5 ms
4,656 KB
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 AC 2 ms
4,372 KB
testcase_08 WA -
testcase_09 WA -
testcase_10 AC 1 ms
4,372 KB
testcase_11 WA -
testcase_12 WA -
testcase_13 AC 2 ms
4,368 KB
testcase_14 AC 2 ms
4,372 KB
testcase_15 WA -
testcase_16 AC 18 ms
14,084 KB
testcase_17 AC 18 ms
14,144 KB
testcase_18 AC 18 ms
14,092 KB
testcase_19 AC 18 ms
14,056 KB
testcase_20 AC 18 ms
14,204 KB
testcase_21 AC 17 ms
14,088 KB
testcase_22 AC 18 ms
14,052 KB
testcase_23 WA -
testcase_24 AC 18 ms
14,108 KB
testcase_25 AC 2 ms
4,368 KB
testcase_26 AC 18 ms
14,140 KB
testcase_27 AC 18 ms
14,088 KB
testcase_28 AC 17 ms
14,320 KB
testcase_29 AC 18 ms
14,108 KB
testcase_30 AC 18 ms
14,104 KB
testcase_31 AC 18 ms
14,056 KB
testcase_32 WA -
testcase_33 AC 18 ms
14,052 KB
testcase_34 AC 2 ms
4,368 KB
testcase_35 AC 18 ms
14,156 KB
testcase_36 AC 17 ms
14,092 KB
testcase_37 AC 18 ms
14,096 KB
testcase_38 AC 2 ms
4,372 KB
testcase_39 AC 1 ms
4,368 KB
testcase_40 AC 11 ms
9,600 KB
testcase_41 AC 16 ms
11,740 KB
testcase_42 AC 7 ms
6,764 KB
testcase_43 AC 17 ms
14,100 KB
testcase_44 AC 18 ms
14,092 KB
testcase_45 AC 17 ms
14,032 KB
testcase_46 AC 18 ms
14,068 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
#include <atcoder/all>
using namespace atcoder;

#define ll long long
#define rep(i, n) for (int i = 0; i < (n); i++)
#define P pair<int, int>
#define LP pair<ll, ll>
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define all(s) s.begin(), s.end()
#define rall(s) s.rbegin(), s.rend()
template<class T>
void chmax(T& a, T b) { a = max(a, b); };
template<class T>
void chmin(T& a, T b) { a = min(a, b); };
using mint = modint998244353;

int main() {
  int n, x, y;
  cin >> n >> x >> y;
  if (x > y) swap(x,y);
  if (y-1==x) {
    cout << 0 << endl;
    return 0;
  }
  int d = y-1-(x+1)+1;
  if (x == 1) d++;
  if (y == n) d++;
  vector dp(n+1, vector<mint>(2));
  dp[1][0] = 1;
  for (int i = 1; i < n; i++) {
    dp[i+1][0] = dp[i][0]+dp[i][1];
    dp[i+1][1] = dp[i-1][0];
  }
  cout << dp[d][0].val() << endl;
  
  return 0;
}
0