結果
| 問題 |
No.15 カタログショッピング
|
| コンテスト | |
| ユーザー |
ytft
|
| 提出日時 | 2021-03-03 07:25:15 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 777 bytes |
| コンパイル時間 | 1,805 ms |
| コンパイル使用メモリ | 170,992 KB |
| 実行使用メモリ | 10,276 KB |
| 最終ジャッジ日時 | 2024-10-03 03:06:44 |
| 合計ジャッジ時間 | 8,408 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 5 TLE * 1 -- * 4 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
int main(){
int n,s;
cin>>n>>s;
vector<long long> price(n);
vector<bool> bought(n,true);
long long current=0;
for(int i=0;i<n;i++){
cin>>price[i];
current+=price[i];
}
long long lp=pow(2,n);
for(long long j=0;j<lp;j++){
if(current==s){
for(int i=0;i<n;i++){
if(bought[i]){
cout<<i+1<<" ";
}
}
cout<<endl;
}
for(int i=n-1;i>=0;i--){
if(bought[i]){
bought[i]=false;
current-=price[i];
break;
}else{
bought[i]=true;
current+=price[i];
}
}
}
}
ytft