結果

問題 No.1967 Sugoroku Optimization
ユーザー たたき@競プロたたき@競プロ
提出日時 2023-08-11 19:48:45
言語 C++23
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 565 ms / 2,000 ms
コード長 709 bytes
コンパイル時間 5,221 ms
コンパイル使用メモリ 312,816 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-04-29 11:06:21
合計ジャッジ時間 10,600 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 AC 2 ms
5,376 KB
testcase_02 AC 2 ms
5,376 KB
testcase_03 AC 560 ms
5,376 KB
testcase_04 AC 2 ms
5,376 KB
testcase_05 AC 495 ms
5,376 KB
testcase_06 AC 540 ms
5,376 KB
testcase_07 AC 2 ms
5,376 KB
testcase_08 AC 380 ms
5,376 KB
testcase_09 AC 285 ms
5,376 KB
testcase_10 AC 136 ms
5,376 KB
testcase_11 AC 19 ms
5,376 KB
testcase_12 AC 346 ms
5,376 KB
testcase_13 AC 170 ms
5,376 KB
testcase_14 AC 11 ms
5,376 KB
testcase_15 AC 11 ms
5,376 KB
testcase_16 AC 18 ms
5,376 KB
testcase_17 AC 21 ms
5,376 KB
testcase_18 AC 2 ms
5,376 KB
testcase_19 AC 2 ms
5,376 KB
testcase_20 AC 565 ms
5,376 KB
testcase_21 AC 2 ms
5,376 KB
testcase_22 AC 565 ms
5,376 KB
testcase_23 AC 339 ms
5,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#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,k;cin>>n>>k;
  vc<mint>dp(k+1,0); dp[0]=1;
  rep(i,n){
    vc<mint>nd(k+1,0);
    for(int j=1;j<=k;j++)nd[j]=dp[j-1]/(i+1);
    if(i==n-1){
      dp=nd;
      break;
    }
    for(int j=1;j<=k;j++)dp[j]+=nd[j];
  }
  mint ans=0; 
  for(auto au:dp)ans+=au;
  cout<<ans.val();
}
0