結果
| 問題 | 
                            No.1701 half price
                             | 
                    
| コンテスト | |
| ユーザー | 
                             | 
                    
| 提出日時 | 2022-09-29 00:47:59 | 
| 言語 | C++17  (gcc 13.3.0 + boost 1.87.0)  | 
                    
| 結果 | 
                             
                                WA
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 526 bytes | 
| コンパイル時間 | 2,080 ms | 
| コンパイル使用メモリ | 195,264 KB | 
| 最終ジャッジ日時 | 2025-02-07 18:08:19 | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge3 / judge2 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 2 | 
| other | AC * 16 WA * 4 | 
ソースコード
#include<bits/stdc++.h>
using namespace std;
int main(){
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int N,W;
  cin>>N>>W;
  vector<int>A(N);
  for(auto &i:A)cin>>i;
  int ans=0;
  for(int i=0;i<1<<N;i++){
    vector<int>B;
    for(int j=0;j<N;j++){
      if(i>>j&1)B.push_back(A[j]);
    }
    int t=0;
    for(int j=0;j<1<<B.size();j++){
      long long s=0;
      for(int k=0;k<B.size();k++){
        if(j>>k&1)s+=B[k]/2;
        else s+=B[k];
      }
      if(s==W)t=1;
    }
    ans+=t;
  }
  cout<<ans<<'\n';
}