結果
| 問題 |
No.2791 Beginner Contest
|
| コンテスト | |
| ユーザー |
PyonPyon
|
| 提出日時 | 2024-06-21 21:53:41 |
| 言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 7 ms / 2,000 ms |
| コード長 | 720 bytes |
| コンパイル時間 | 3,782 ms |
| コンパイル使用メモリ | 275,556 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-06-21 21:53:47 |
| 合計ジャッジ時間 | 4,690 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 17 |
ソースコード
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#include <atcoder/fenwicktree>
using namespace atcoder;
using namespace std;
typedef long long ll;
typedef pair<ll,ll> pi;
#define ALL(x) x.begin(),x.end()
#define rep(i,a,b) for(int i=a;i<b;i++)
using vi = vector<int>;
using vvi = vector<vi>;
using li =vector<ll>;
using lli=vector<li>;
using si =vector<char>;
using ssi =vector<si>;
const long long INF = 1e18;
const long long MOD=998244353;
//for (auto [key, val] : mp)
int main() {
ll n,k;cin>>n>>k;
fenwick_tree<ll>bit(n+1);
li dp(n+1);
bit.add(0,1);
dp[0]=1;
rep(i,0,n){
if(i+1-k<0)continue;
else{
dp[i+1]=bit.sum(0,i+2-k)%998244353;
bit.add(i+1,dp[i+1]);
}
}
cout<<bit.sum(0,n+1)%998244353;
}
PyonPyon