結果
| 問題 |
No.2857 Div Array
|
| コンテスト | |
| ユーザー |
寝癖
|
| 提出日時 | 2024-08-25 15:21:24 |
| 言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
RE
|
| 実行時間 | - |
| コード長 | 3,035 bytes |
| コンパイル時間 | 4,739 ms |
| コンパイル使用メモリ | 312,440 KB |
| 実行使用メモリ | 814,800 KB |
| 最終ジャッジ日時 | 2024-08-25 15:21:32 |
| 合計ジャッジ時間 | 8,002 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 10 RE * 6 MLE * 1 -- * 13 |
ソースコード
#include <bits/stdc++.h>
#include <atcoder/all>
namespace neguse {}
using namespace std;
using namespace atcoder;
using namespace neguse;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<ld> vld;
typedef vector<vi> vvi;
typedef vector<vll> vvll;
typedef vector<string> vs;
typedef vector<pii> vpii;
typedef vector<pll> vpll;
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define _rrep(i,n) rrepi(i,n-1,-1)
#define rrepi(i,a,b) for(int i=int(a);i>int(b);--i)
#define rrep(...) _overload3(__VA_ARGS__,rrepi,_rrep)(__VA_ARGS__)
#define _each1(i,v) for(auto& i:v)
#define _each2(i,j,v) for(auto& [i,j]:v)
#define each(...) _overload3(__VA_ARGS__,_each2,_each1,)(__VA_ARGS__)
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define SORT(x) sort(all(x))
#define RSORT(x) sort(rall(x))
#define REVERSE(x) reverse(all(x))
#define dump(x) cerr << #x << " = " << (x) << '\n'
#define print(x) cout << (x) << '\n'
#define yes(f) cout << ((f) ? "Yes" : "No") << '\n'
#define ge(v, x) (int)(lower_bound(all(v), x) - v.begin())
#define gt(v, x) (int)(upper_bound(all(v), x) - v.begin())
#define le(v, x) (int)(upper_bound(all(v), x) - v.begin())-1
#define lt(v, x) (int)(lower_bound(all(v), x) - v.begin())-1
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
ostream& operator<<(ostream& os, const modint998244353& a) { return os << a.val(); }
ostream& operator<<(ostream& os, const modint1000000007& a) { return os << a.val(); }
template<class T> istream& operator>>(istream& is, vector<T>& vec) { for (T& x : vec) is >> x; return is; }
template<class T> ostream& operator<<(ostream& os, const vector<T>& vec) { for (const T& x : vec) os << x << ' '; return os; }
using namespace neguse;
int main() {
int N, M, K;
cin >> N >> M >> K;
auto range = [&](int a) {
// 直後がaである時、前の値の範囲
int l = max(1, M / a - K);
int r = M / a + K;
int left, right;
if (M % (r + 1) == 0) {
left = M / (r + 1) + 1;
} else {
left = (M + r) / (r + 1);
}
right = M / l;
chmax(left, 0);
chmin(right, M);
return make_pair(left, right);
};
using mint = modint998244353;
vector dp(N + 1, vector<mint>(M + 1, 0));
rep(m, 1, M + 1) dp[1][m] = 1;
rep(n, 2, N + 1) {
vector<mint> sum(M + 1, 0);
rep(m, 1, M + 1) sum[m] = sum[m - 1] + dp[n - 1][m];
rep(m, 1, M + 1) {
auto [l, r] = range(m);
dp[n][m] = sum[r] - sum[l - 1];
}
}
mint ans = 0;
rep(m, 1, M + 1) ans += dp[N][m];
cout << ans << endl;
return 0;
}
寝癖