結果

問題 No.3696 Betting Machine
コンテスト
ユーザー simasima_71
提出日時 2026-09-09 22:03:06
言語 C++23(gcc16)
(gcc 16.1.0 + boost 1.92.0 + ACL)
コンパイル:
g++-16 -O2 -lm -std=c++23 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
AC  
実行時間 45 ms / 1,500 ms
+ 182µs
コード長 1,624 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 5,145 ms
コンパイル使用メモリ 360,900 KB
実行使用メモリ 6,528 KB
最終ジャッジ日時 2026-09-09 22:03:22
合計ジャッジ時間 6,579 ms
ジャッジサーバーID
(参考情報)
judge2_0 / judge4_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 21
権限があれば一括ダウンロードができます
コンパイルメッセージ
In file included from /home/linuxbrew/.linuxbrew/Cellar/gcc/16.2.0/include/c++/16/vector:67,
                 from /home/linuxbrew/.linuxbrew/Cellar/gcc/16.2.0/include/c++/16/functional:81,
                 from /home/linuxbrew/.linuxbrew/Cellar/gcc/16.2.0/include/c++/16/x86_64-pc-linux-gnu/bits/stdc++.h:53,
                 from main.cpp:1:
In function '_ForwardIterator std::uninitialized_copy(_InputIterator, _InputIterator, _ForwardIterator) [with _InputIterator = long long int*; _ForwardIterator = long long int*]',
    inlined from 'constexpr _ForwardIterator std::__uninitialized_copy_a(_InputIterator, _Sentinel, _ForwardIterator, allocator<_Tp>&) [with _InputIterator = long long int*; _Sentinel = long long int*; _ForwardIterator = long long int*; _Tp = long long int]' at /home/linuxbrew/.linuxbrew/Cellar/gcc/16.2.0/include/c++/16/bits/stl_uninitialized.h:659:32,
    inlined from 'constexpr std::vector<_Tp, _Alloc>& std::vector<_Tp, _Alloc>::operator=(const std::vector<_Tp, _Alloc>&) [with _Tp = long long int; _Alloc = std::allocator<long long int>]' at /home/linuxbrew/.linuxbrew/Cellar/gcc/16.2.0/include/c++/16/bits/vector.tcc:261:35,
    inlined from 'int main()' at main.cpp:47:11:
/home/linuxbrew/.linuxbrew/Cellar/gcc/16.2.0/include/c++/16/bits/stl_uninitialized.h:294:31: warning: 'void* __builtin_memcpy(void*, const void*, long unsigned int)' writing between 1 and 8008 bytes into a region of size 0 overflows the destination [-Wstringop-overflow=]
  294 |               __builtin_memcpy(std::__niter_base(__result),
      |               ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  295 |                                std::__niter_base(__first),
      |                                ~~~~~~~~~~~~~~~~~~~~~~~~~~~
  296 |                                __n * sizeof(_ValT));
      |                                ~~~~~~~~~~~~~~~~~~~~
In file included from /home/linuxbrew/.linuxbrew/Cellar/gcc/16.2.0/include/c++/16/x86_64-pc-linux-gnu/bits/c++allocator.h:33,
     

ソースコード

diff #
raw source code

#include <bits/stdc++.h>
using namespace std;
#define rep(i, l, r) for (ll i = (l); i < (r); ++i)
#define all(x) (x).begin(), (x).end()
using ll = long long;
using pl = pair<ll,ll>;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
using vi = vector<int>;
using vvi = vector<vector<int>>;
#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")

int main(){
    ll s,t,n;
    cin>>s>>t>>n;
    vl p(3);
    vl a(3);
    vl b(3);
    rep(i,0,3){
        cin>>p[i]>>a[i]>>b[i];
    }

    vector<ll> u(1001,0);
    ll re=1000000000000000000;
    rep(i,t,1001){
        u[i]=re;
    }
    vl d;
    rep(ar,0,n){
        if(ar==n-1)d=u;
        vl e(1001,0);
        rep(i,0,1001){
            ll mx=0;
                rep(j,0,i+1){
                    ll zn=0;
                    rep(l,0,3){
                        ll er=i-j+(a[l]*j)/(b[l]);
                        if(er>=1000)zn+=u[1000]/100*p[l];
                        else zn+=u[er]/100*p[l];
                    }
                    mx=max(mx,zn);
                }
            e[i]=mx;
        }
        u=e;
    }
    ll r=u[s];
    rep(i,0,8)r/=100;
    cout<<r<<endl;
    vl ans;
    rep(j,1,s+1){
                    ll zn=0;
                    rep(l,0,3){
                        ll er=s-j+(a[l]*j)/(b[l]);
                        if(er>=1000)zn+=d[1000]/100*p[l];
                        else zn+=d[er]/100*p[l];
                    }
        if(zn==u[s])ans.push_back(j);
    }
    cout<<ans.size()<<endl;
    rep(i,0,ans.size()){
        cout<<ans[i];
        if(i!=(ll)ans.size()-1)cout<<" ";
    }
    cout<<endl;
}
0