結果
| 問題 |
No.1701 half price
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2022-09-29 17:02:48 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 544 bytes |
| コンパイル時間 | 1,999 ms |
| コンパイル使用メモリ | 196,084 KB |
| 最終ジャッジ日時 | 2025-02-07 18:20:15 |
|
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| 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);
long long N,W;
cin>>N>>W;
vector<long long>A(N);
for(auto &i:A)cin>>i;
int ans=0;
for(int i=0;i<1<<N;i++){
vector<long long>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';
}