結果
問題 |
No.1885 Flat Permutation
|
ユーザー |
![]() |
提出日時 | 2023-08-12 00:43:40 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 619 bytes |
コンパイル時間 | 4,669 ms |
コンパイル使用メモリ | 310,072 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-11-18 20:23:25 |
合計ジャッジ時間 | 5,973 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 WA * 1 |
other | AC * 23 WA * 20 |
ソースコード
#include<bits/stdc++.h> using namespace std; #include <atcoder/all> using namespace atcoder; using mint=modint998244353; //1000000007; using ll=long long; using pp=pair<int,int>; #define sr string #define vc vector #define fi first #define se second #define rep(i,n) for(int i=0;i<(int)n;i++) #define pb push_back #define all(v) v.begin(),v.end() #define pque priority_queue #define bpc(a) __builtin_popcount(a) int main(){ int n,x,y;cin>>n>>x>>y; if(x>y)swap(x,y); int d=y-x-1; vc<mint>dp(d+1,0); dp[1]=1; for(int i=2;i<=d;i++){ dp[i]+=dp[i-1]; if(i-3>=1)dp[i]+=dp[i-3]; } cout<<dp[d].val(); }