結果
問題 | No.1967 Sugoroku Optimization |
ユーザー | 沙耶花 |
提出日時 | 2022-06-03 21:41:16 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 633 ms / 2,000 ms |
コード長 | 487 bytes |
コンパイル時間 | 4,232 ms |
コンパイル使用メモリ | 252,360 KB |
最終ジャッジ日時 | 2025-01-29 17:36:07 |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 21 |
ソースコード
#include <stdio.h> #include <atcoder/all> #include <bits/stdc++.h> using namespace std; using namespace atcoder; using mint = modint998244353; #define rep(i,n) for (int i = 0; i < (n); ++i) #define Inf 1000000003 int main() { int N,K; cin>>N>>K; vector<mint> dp(N+1,0); dp[N] = 1; rep(_,K){ vector<mint> ndp(N+1,0); ndp[N] = dp[N]; mint sum = 0; for(int j=N-1;j>=0;j--){ sum += dp[j+1]; ndp[j] = sum / (N-j); } swap(dp,ndp); } cout<<dp[0].val()<<endl; }