結果

問題 No.1701 half price
ユーザー CleyLCleyL
提出日時 2023-03-28 15:35:11
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 517 bytes
コンパイル時間 632 ms
コンパイル使用メモリ 73,528 KB
実行使用メモリ 4,348 KB
最終ジャッジ日時 2023-10-20 09:51:43
合計ジャッジ時間 6,179 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <iostream>
#include <vector>
using namespace std;
int main(){
  long long n,w;cin>>n>>w;
  vector<long long> A(n);
  for(int i = 0; n > i; i++)cin>>A[i];
  long long ans = 0;
  for(int j = 0; (1<<n) > j; j++){
    for(int i = 0; (1<<n) > i; i++){
      long long tmp = 0;
      for(int k = 0; n > k; k++){
        if(j & (1<<k)){
          if(i & (1<<k))tmp += A[k]/2;
          else tmp += A[k];
        }
      }
      if(tmp == w){
        ans++;
        break;
      }
    }
  }
  cout << ans << endl;
}
0