結果

問題 No.1701 half price
ユーザー gotetengoteten
提出日時 2021-10-08 22:11:24
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 589 bytes
コンパイル時間 1,673 ms
コンパイル使用メモリ 176,948 KB
実行使用メモリ 8,756 KB
最終ジャッジ日時 2023-09-30 10:28:51
合計ジャッジ時間 11,029 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

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