結果
| 問題 |
No.2791 Beginner Contest
|
| コンテスト | |
| ユーザー |
yumekawayui
|
| 提出日時 | 2024-06-21 23:13:15 |
| 言語 | C++17(clang) (17.0.6 + boost 1.87.0) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 2,079 bytes |
| コンパイル時間 | 5,001 ms |
| コンパイル使用メモリ | 183,552 KB |
| 実行使用メモリ | 14,112 KB |
| 最終ジャッジ日時 | 2024-06-21 23:13:25 |
| 合計ジャッジ時間 | 8,492 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 TLE * 1 |
| other | -- * 17 |
コンパイルメッセージ
main.cpp:51:19: warning: expression result unused [-Wunused-value]
51 | mint ans=1;n-k+1;
| ~~~^~
1 warning generated.
ソースコード
#include <bits/stdc++.h>
#include <atcoder/all>
using namespace std;
using namespace atcoder;
const vector<int> dx = {0, 0, 1, -1};
const vector<int> dy = {1, -1, 0, 0};
#define vec vector
#define int long long
#define double long double
#define ll long long
#define pii pair<int,int>
#define pq priority_queue
#define all(V) begin(V),end(V)
#define tple tuple<int,int,int>
template<class T, class U> inline bool chmax(T &a, const U &b) { if (a < b) { a = b; return true; } return false; }
template<class T, class U> inline bool chmin(T &a, const U &b) { if (a > b) { a = b; return true; } return false; }
#define nexper(Z) next_permutation(all(Z))
#define pb push_back
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define req(i, x, n) for (int i = x; i < (int)(n); i++)
#define rex(i, n) for (int i = 1; i <= (int)(n); i++)
#define rey(i, x, n) for (int i = x; i <= (int)(n); i++)
#define cleout(i) cout << fixed << setprecision(i)
struct Point {long long x, y;};
Point operator+(const Point& a1, const Point& a2) {return Point{ a1.x + a2.x, a1.y + a2.y };}
Point operator-(const Point& a1, const Point& a2) {return Point{ a1.x - a2.x, a1.y - a2.y };}
bool operator<(const Point& a1, const Point& a2) {if (a1.x < a2.x) return true;if (a1.x > a2.x) return false;if (a1.y < a2.y) return true;return false;}
using mint=modint998244353;
using S = long long;
using F = long long;
const S INF = 8e18;
S op(S a, S b){ return std::max(a, b)%998244353; }
S e(){ return -INF; }
S mapping(F f, S x){ return (f+x)%998244353; }
F composition(F f, F g){ return (f+g)%998244353; }
F id(){ return 0; }
signed main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
int n,k;cin>>n>>k;
map<int,mint> dp;
dp[0]=1;
if(k>n){
cout<<1;return 0;
}
mint ans=1;n-k+1;
mint pre=n-k+1;
rep(i,n){
if(dp.size()==0){break;}
map<int,mint> ndp;
for(auto x:dp){
for(int j=x.first+k;j<=n;j++){
ndp[j]+=dp[x.first];ans+=dp[x.first];
}
}
swap(ndp,dp);
}
cout<<ans.val();
return 0;
}
yumekawayui