結果

問題 No.2161 Black Market
ユーザー AngrySadEightAngrySadEight
提出日時 2022-11-23 14:55:41
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
TLE  
実行時間 -
コード長 662 bytes
コンパイル時間 735 ms
コンパイル使用メモリ 78,620 KB
実行使用メモリ 8,704 KB
最終ジャッジ日時 2024-04-22 19:08:04
合計ジャッジ時間 9,715 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
5,248 KB
testcase_01 AC 2 ms
5,376 KB
testcase_02 AC 16 ms
5,376 KB
testcase_03 AC 2 ms
5,376 KB
testcase_04 AC 1 ms
5,376 KB
testcase_05 AC 2 ms
5,376 KB
testcase_06 AC 17 ms
5,376 KB
testcase_07 AC 16 ms
5,376 KB
testcase_08 AC 16 ms
5,376 KB
testcase_09 AC 18 ms
5,376 KB
testcase_10 AC 17 ms
5,376 KB
testcase_11 AC 16 ms
5,376 KB
testcase_12 AC 16 ms
5,376 KB
testcase_13 AC 2 ms
5,376 KB
testcase_14 AC 3 ms
5,376 KB
testcase_15 AC 9 ms
5,376 KB
testcase_16 AC 16 ms
5,376 KB
testcase_17 AC 2 ms
5,376 KB
testcase_18 AC 1 ms
5,376 KB
testcase_19 AC 16 ms
5,376 KB
testcase_20 TLE -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
testcase_33 -- -
testcase_34 -- -
testcase_35 -- -
testcase_36 -- -
testcase_37 -- -
testcase_38 -- -
testcase_39 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
typedef long long ll;

int main(){
    ll N, K, L, P;
    cin >> N >> K >> L >> P;
    vector<ll> A(N);
    vector<ll> B(N);
    for (ll i = 0; i < N; i++){
        cin >> A[i] >> B[i];
    }
    ll ans = 0;
    for (ll i = 0; i < (1LL << N); i++){
        ll popcnt = 0;
        ll a = 0;
        ll b = 0;
        for (ll j = 0; j < N; j++){
            if ((i >> j) & 1){
                popcnt++;
                a += A[j];
                b += B[j];
            }
        }
        if (popcnt > K) continue;
        if (a <= L && b >= P) ans++;
    }
    cout << ans << endl;
}
0