結果
問題 | No.1701 half price |
ユーザー |
![]() |
提出日時 | 2021-10-08 22:11:24 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 589 bytes |
コンパイル時間 | 1,917 ms |
コンパイル使用メモリ | 179,204 KB |
実行使用メモリ | 10,140 KB |
最終ジャッジ日時 | 2024-07-23 04:35:28 |
合計ジャッジ時間 | 11,246 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 WA * 1 |
other | AC * 3 WA * 1 TLE * 1 -- * 15 |
ソースコード
#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<<(2*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; }