結果

問題 No.3480 Prefix Advantage
コンテスト
ユーザー 👑 potato167
提出日時 2026-03-20 00:12:26
言語 C++17
(gcc 15.2.0 + boost 1.89.0)
コンパイル:
g++-15 -O2 -lm -std=c++17 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
TLE  
実行時間 -
コード長 747 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 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
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#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";
}
0