結果
| 問題 |
No.2329 Nafmo、イカサマをする
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2023-05-28 16:50:53 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 760 bytes |
| コンパイル時間 | 2,189 ms |
| コンパイル使用メモリ | 206,536 KB |
| 最終ジャッジ日時 | 2025-02-13 15:32:03 |
|
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 14 WA * 26 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,n) for (int i=0;i<(int)(n);i++)
int main(){
ll n,m,k;
cin>>n>>m>>k;
vector<ll> a(n);
rep(i,n) cin>>a.at(i);
a.push_back(0);
sort(a.begin(),a.end());
set<ll> st1={0},st2={0};
int dv=k/2;
rep(i,dv){
set<ll> st3;
for(ll x:st1){
for(ll y:a){
st3.insert(x+y);
}
}
swap(st1,st3);
}
rep(i,k-dv){
set<ll> st3;
for(ll x:st2){
for(ll y:a){
st3.insert(x+y);
}
}
swap(st2,st3);
}
ll ans=0;
for(ll x:st2){
if(x>m) break;
ll df=m-x;
auto itr=st1.lower_bound(df);
if(itr==st1.end()) itr--;
ll y=*itr;
if(x+y>m) continue;
ans=max(ans,x+y);
}
cout<<ans<<endl;
}