結果
問題 |
No.1701 half price
|
ユーザー |
![]() |
提出日時 | 2021-10-08 22:07:19 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 585 bytes |
コンパイル時間 | 2,198 ms |
コンパイル使用メモリ | 179,616 KB |
実行使用メモリ | 6,948 KB |
最終ジャッジ日時 | 2024-07-23 04:26:34 |
合計ジャッジ時間 | 2,699 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | WA * 2 |
other | AC * 7 WA * 13 |
ソースコード
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < n; i++) #define all(x) (x).begin(),(x).end() const int mod = 1000000007; const long long INF = 1LL << 60; using ll = long long; int main() { ll N,W; cin >> N >> W; vector<int> a(2*N); rep(i,N){ cin >> a[i]; a[i+N]=a[i]/2; } set<set<int>> ansset; rep(k,1<<N){ ll price=0; set<int> se; rep(i,2*N){ if((1<<i)&k){ price+=a[i]; se.insert(i%N); } } if(price==W){ ansset.insert(se); } } cout << ansset.size() << endl; }