結果

問題 No.1463 Hungry Kanten
ユーザー Noboru2020Noboru2020
提出日時 2021-04-02 21:28:28
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
(最新)
AC  
(最初)
実行時間 -
コード長 462 bytes
コンパイル時間 1,437 ms
コンパイル使用メモリ 172,236 KB
実行使用メモリ 15,648 KB
最終ジャッジ日時 2023-08-25 14:46:09
合計ジャッジ時間 2,689 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 AC 129 ms
15,648 KB
testcase_06 AC 1 ms
4,380 KB
testcase_07 AC 1 ms
4,380 KB
testcase_08 AC 1 ms
4,380 KB
testcase_09 AC 1 ms
4,376 KB
testcase_10 AC 1 ms
4,376 KB
testcase_11 AC 2 ms
4,376 KB
testcase_12 AC 2 ms
4,376 KB
testcase_13 AC 1 ms
4,376 KB
testcase_14 AC 2 ms
4,376 KB
testcase_15 AC 2 ms
4,376 KB
testcase_16 AC 5 ms
4,376 KB
testcase_17 AC 12 ms
4,720 KB
testcase_18 AC 6 ms
4,376 KB
testcase_19 AC 56 ms
9,888 KB
testcase_20 AC 78 ms
10,812 KB
testcase_21 AC 1 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
#define int long long
signed main(){
  int N,K;cin>>N>>K;
  vector<int>vec(N);
  for(int &i:vec){
    cin>>i;
  }
  set<int>ans;
  for(int i=0;i<(1<<N);i++){
    int memo=0,sum=0,product=1;
    for(int j=0;j<N;j++){
      if(i&(1<<j)){
        memo++;
        sum+=vec[j];
        product*=vec[j];
      }
    }
    if(memo>=K){
      ans.insert(sum);
      ans.insert(product);
    }
  }
  cout<<ans.size()<<endl;
}
0