結果
| 問題 | No.3480 Prefix Advantage |
| コンテスト | |
| ユーザー |
👑 potato167
|
| 提出日時 | 2026-03-20 00:12:26 |
| 言語 | C++17 (gcc 15.2.0 + boost 1.89.0) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 747 bytes |
| 記録 | |
| コンパイル時間 | 3,686 ms |
| コンパイル使用メモリ | 252,924 KB |
| 実行使用メモリ | 1,336,936 KB |
| 最終ジャッジ日時 | 2026-03-20 21:00:01 |
| 合計ジャッジ時間 | 45,382 ms |
|
ジャッジサーバーID (参考情報) |
judge2_1 / judge1_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 21 TLE * 10 MLE * 2 -- * 27 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
#include <atcoder/convolution>
using mint = atcoder::modint998244353;
#define rep(i, a, b) for (int i = a; i < b; i++)
vector<mint> solve_fast_1(int N, int P, int Q){
vector<mint> ans(N);
vector dp(P + 1, vector<mint>(Q + 1));
dp[0][0] = 1;
rep(rp, 0, N){
rep(i, 0, P + 1) rep(j, 0, Q + 1){
if (i * Q < j * P) dp[i][j] = 0;
}
ans[rp] = dp[P][Q];
rep(i, 0, P + 1) rep(j, 0, Q) dp[i][j + 1] += dp[i][j];
rep(i, 0, P) rep(j, 0, Q + 1) dp[i + 1][j] += dp[i][j];
}
return ans;
}
int main(){
int N, P, Q;
cin >> N >> P >> Q;
N++;
auto ans = solve_fast_1(N, P, Q);
for (int i = 1; i < N; i++) cout << ans[i].val() << "\n";
}
potato167