結果
| 問題 |
No.3076 Goodstuff Deck Builder
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2025-03-28 22:01:26 |
| 言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 883 bytes |
| コンパイル時間 | 5,846 ms |
| コンパイル使用メモリ | 333,956 KB |
| 実行使用メモリ | 7,328 KB |
| 最終ジャッジ日時 | 2025-03-28 22:01:49 |
| 合計ジャッジ時間 | 21,461 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 25 WA * 11 |
ソースコード
#include <bits/stdc++.h>
#include <atcoder/all>
using namespace std;
using namespace atcoder;
using ll=long long;
int main()
{
ll n,m;
cin>>n>>m;
vector<pair<ll,ll>> cd(n);
for(int i=0;i<n;i++)cin>>cd[i].first>>cd[i].second;
sort(cd.begin(),cd.end(),[](auto x,auto y)->bool{
return x.first>y.first;
});
ll ans2=0;
while((!cd.empty())&&cd.back().first==0){
ans2+=cd.back().second;
cd.pop_back();
}
vector<vector<ll>> crt(m+1,vector<ll>(11));
for(int i=0;i<n;i++){
vector<vector<ll>> nxt(m+1,vector<ll>(11));
for(int j=0;j<=m;j++){
for(int k=0;k<=10;k++){
ll x=(cd[i].first<<k);
nxt[j][k]=max(nxt[j][k],crt[j][k]);
if(k<10&&j+x<=m){
nxt[j+x][k+1]=max(nxt[j+x][k+1],crt[j][k]+cd[i].second);
}
}
}
swap(crt,nxt);
}
ll ans=0;
for(int i=0;i<=m;i++)for(int j=0;j<=10;j++)ans=max(ans,crt[i][j]);
cout<<ans<<endl;
return 0;
}