結果

問題 No.2329 Nafmo、イカサマをする
ユーザー erbowlerbowl
提出日時 2023-07-07 08:01:13
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
TLE  
実行時間 -
コード長 1,221 bytes
コンパイル時間 2,172 ms
コンパイル使用メモリ 209,136 KB
実行使用メモリ 377,716 KB
最終ジャッジ日時 2023-09-28 08:20:36
合計ジャッジ時間 7,683 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
8,760 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 2 ms
4,376 KB
testcase_03 AC 2 ms
4,376 KB
testcase_04 AC 1 ms
4,376 KB
testcase_05 AC 1 ms
4,376 KB
testcase_06 AC 2 ms
4,376 KB
testcase_07 AC 2 ms
4,376 KB
testcase_08 AC 5 ms
4,380 KB
testcase_09 AC 1 ms
4,376 KB
testcase_10 AC 1 ms
4,376 KB
testcase_11 AC 1 ms
4,380 KB
testcase_12 AC 1 ms
4,376 KB
testcase_13 AC 1 ms
4,380 KB
testcase_14 AC 1 ms
4,380 KB
testcase_15 AC 2 ms
4,376 KB
testcase_16 AC 2 ms
4,380 KB
testcase_17 AC 2 ms
4,376 KB
testcase_18 AC 2 ms
4,380 KB
testcase_19 AC 22 ms
7,212 KB
testcase_20 AC 27 ms
7,804 KB
testcase_21 AC 28 ms
8,220 KB
testcase_22 AC 22 ms
7,008 KB
testcase_23 AC 2 ms
4,380 KB
testcase_24 AC 1 ms
4,380 KB
testcase_25 AC 2 ms
4,380 KB
testcase_26 AC 1 ms
4,376 KB
testcase_27 AC 2 ms
4,376 KB
testcase_28 AC 1 ms
4,376 KB
testcase_29 AC 85 ms
15,932 KB
testcase_30 AC 3 ms
4,376 KB
testcase_31 AC 1 ms
4,380 KB
testcase_32 AC 2 ms
4,380 KB
testcase_33 AC 2 ms
4,380 KB
testcase_34 AC 1 ms
4,376 KB
testcase_35 AC 4 ms
4,380 KB
testcase_36 TLE -
testcase_37 -- -
testcase_38 -- -
testcase_39 -- -
testcase_40 -- -
testcase_41 -- -
testcase_42 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

typedef long long ll;
typedef long double ld;
#include <bits/stdc++.h>
using namespace std;
#define int long long

signed main(){
    ll n,m,k;
    std::cin >> n>>m>>k;
    vector<ll> a(n);
    vector<ll> b,c;
    for (int i = 0; i < n; i++) {
        std::cin >> a[i];
        if(i<n/2){
            b.push_back(a[i]);
        }else{
            c.push_back(a[i]);
        }
    }
    
    vector<set<ll>> v1(k+1);
    vector<set<ll>> v2(k+1);
    v1[0].insert(0);
    v2[0].insert(0);
    for (auto e : b) {
        for (int i = 0; i < k; i++) {
            for (auto ee : v1[i]) {
                v1[i+1].insert(ee+e);
            }
        }
    }
    
    for (auto e : c) {
        for (int i = 0; i < k; i++) {
            for (auto ee : v2[i]) {
                v2[i+1].insert(ee+e);
            }
        }
    }
    ll ans = 0;
    
    for (int i = 0; i <= k; i++) {
        for (int j = 0; j <= k; j++) {
            if(i+j>k)continue;
            for (auto e1 : v1[i]) {
                for (auto e2 : v2[j]) {
                    if(e1+e2<=m){
                        ans = max(ans, e1+e2);
                    }
                }
            }
        }
    }
    
    std::cout << ans << std::endl;
    
}
0