結果

問題 No.1701 half price
ユーザー gotetengoteten
提出日時 2021-10-08 22:07:19
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 585 bytes
コンパイル時間 1,700 ms
コンパイル使用メモリ 177,484 KB
実行使用メモリ 4,904 KB
最終ジャッジ日時 2023-09-30 10:20:25
合計ジャッジ時間 2,243 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 AC 1 ms
4,376 KB
testcase_10 AC 1 ms
4,380 KB
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 AC 1 ms
4,380 KB
testcase_15 AC 1 ms
4,376 KB
testcase_16 AC 1 ms
4,376 KB
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 AC 1 ms
4,376 KB
testcase_21 AC 4 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#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;
}
0