結果
問題 | No.2686 商品券の使い道 |
ユーザー |
|
提出日時 | 2024-03-20 22:16:00 |
言語 | C++17 (gcc 12.3.0 + boost 1.83.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 841 bytes |
コンパイル時間 | 2,306 ms |
コンパイル使用メモリ | 205,616 KB |
実行使用メモリ | 22,164 KB |
最終ジャッジ日時 | 2024-03-20 22:16:17 |
合計ジャッジ時間 | 17,469 ms |
ジャッジサーバーID (参考情報) |
judge15 / judge14 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 2 ms
6,676 KB |
testcase_01 | AC | 2 ms
6,676 KB |
testcase_02 | AC | 463 ms
6,676 KB |
testcase_03 | WA | - |
testcase_04 | WA | - |
testcase_05 | WA | - |
testcase_06 | WA | - |
testcase_07 | WA | - |
testcase_08 | AC | 477 ms
6,676 KB |
testcase_09 | AC | 471 ms
6,676 KB |
testcase_10 | AC | 466 ms
6,676 KB |
testcase_11 | WA | - |
testcase_12 | WA | - |
testcase_13 | AC | 28 ms
6,676 KB |
testcase_14 | WA | - |
testcase_15 | WA | - |
testcase_16 | WA | - |
testcase_17 | WA | - |
testcase_18 | WA | - |
testcase_19 | WA | - |
testcase_20 | AC | 29 ms
6,676 KB |
testcase_21 | WA | - |
testcase_22 | WA | - |
testcase_23 | AC | 498 ms
6,676 KB |
testcase_24 | WA | - |
testcase_25 | AC | 720 ms
6,676 KB |
testcase_26 | WA | - |
testcase_27 | AC | 69 ms
6,676 KB |
testcase_28 | AC | 288 ms
6,676 KB |
testcase_29 | TLE | - |
testcase_30 | -- | - |
testcase_31 | -- | - |
testcase_32 | -- | - |
testcase_33 | -- | - |
testcase_34 | -- | - |
testcase_35 | -- | - |
testcase_36 | -- | - |
testcase_37 | -- | - |
testcase_38 | -- | - |
testcase_39 | -- | - |
testcase_40 | -- | - |
testcase_41 | -- | - |
testcase_42 | -- | - |
testcase_43 | -- | - |
testcase_44 | -- | - |
testcase_45 | -- | - |
testcase_46 | -- | - |
evil_random20_1.txt | -- | - |
evil_random20_2.txt | -- | - |
evil_random20_3.txt | -- | - |
ソースコード
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(nullptr); int N,M,Q; cin >> N >> M >> Q; vector<int> A(N),B(N); for(int i=0; i<N; i++) cin >> A.at(i) >> B.at(i); int n2 = 1<<N,inf = max(M,Q)+1; vector<int> S(n2); vector<long long> S2(n2); for(int i=0; i<n2; i++){ for(int k=0; k<N; k++){ if(!(i&(1<<k))) continue; S.at(i) += A.at(k); S2.at(i) += B.at(k); if(S.at(i) >= inf) break; } } long long answer = 0; for(int i=0; i<n2; i++){ for(int k=i; k>0; k=(k-1)&i){ if(S.at(k) > Q) continue; int left = i-k; if(S.at(left) > M) continue; answer = max(answer,S2.at(i)); break; } } cout << answer << endl; }