結果
問題 |
No.2161 Black Market
|
ユーザー |
![]() |
提出日時 | 2022-11-23 14:55:41 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 662 bytes |
コンパイル時間 | 613 ms |
コンパイル使用メモリ | 74,672 KB |
最終ジャッジ日時 | 2025-02-08 23:27:54 |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 20 TLE * 17 |
ソースコード
#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; }