結果

問題 No.3696 Betting Machine
コンテスト
ユーザー GOTKAKO
提出日時 2026-09-10 17:12:58
言語 C++17
(gcc 15.3.0 + boost 1.92.0 + ACL)
コンパイル:
g++-15 -O2 -lm -std=c++17 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
WA  
実行時間 -
コード長 1,041 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 1,296 ms
コンパイル使用メモリ 221,184 KB
実行使用メモリ 6,528 KB
最終ジャッジ日時 2026-09-10 17:13:07
合計ジャッジ時間 3,343 ms
ジャッジサーバーID
(参考情報)
judge1_0 / judge3_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 8 WA * 13
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#include <bits/stdc++.h>
using namespace std;

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);

    int S,T,N; cin >> S >> T >> N;
    vector<tuple<int,int,int>> PAB(3);
    for(auto &[p,a,b] : PAB) cin >> p >> a >> b;

    long long inf = 1;
    for(int i=0; i<18; i++) inf *= 10;
    vector<vector<long long>> dp(N+1,vector<long long>(T+1));
    for(int i=0; i<=N; i++) dp.at(i).at(T) = inf;
    for(int i=N; i--;) for(int k=0; k<T; k++){
        long long big = 0;
        vector<long long> X;
        for(int x=1; x<=k; x++){
            long long now = 0;
            for(auto [p,a,b] : PAB){
                int to = min(k-x+a*x/b,T);
                now += dp.at(i+1).at(to)/100*p;
            }    
            if(now > big) big = now,X = {x};
            else if(now == big) X.push_back(x);
        }

        if(i == 0 && k == S){
            cout << big/(inf/100) << "\n";
            cout << X.size() << "\n";
            for(auto x : X) cout << x << "\n";
        }
        dp.at(i).at(k) = big;
    }

}
0