結果
| 問題 |
No.1885 Flat Permutation
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2022-08-03 23:59:41 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 909 bytes |
| コンパイル時間 | 4,261 ms |
| コンパイル使用メモリ | 253,264 KB |
| 最終ジャッジ日時 | 2025-01-30 17:23:33 |
|
ジャッジサーバーID (参考情報) |
judge3 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 33 WA * 10 |
ソースコード
#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;
}