結果

問題 No.1463 Hungry Kanten
ユーザー saxofone111saxofone111
提出日時 2021-04-13 22:11:46
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 224 ms / 2,000 ms
コード長 1,199 bytes
コンパイル時間 11,280 ms
コンパイル使用メモリ 427,320 KB
実行使用メモリ 25,224 KB
最終ジャッジ日時 2023-09-12 13:13:10
合計ジャッジ時間 13,146 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 2 ms
4,384 KB
testcase_02 AC 9 ms
4,380 KB
testcase_03 AC 72 ms
4,384 KB
testcase_04 AC 2 ms
4,380 KB
testcase_05 AC 224 ms
25,224 KB
testcase_06 AC 1 ms
4,384 KB
testcase_07 AC 2 ms
4,384 KB
testcase_08 AC 2 ms
4,380 KB
testcase_09 AC 1 ms
4,380 KB
testcase_10 AC 2 ms
4,380 KB
testcase_11 AC 2 ms
4,384 KB
testcase_12 AC 2 ms
4,384 KB
testcase_13 AC 2 ms
4,380 KB
testcase_14 AC 4 ms
4,384 KB
testcase_15 AC 3 ms
4,380 KB
testcase_16 AC 10 ms
4,468 KB
testcase_17 AC 24 ms
5,700 KB
testcase_18 AC 17 ms
4,380 KB
testcase_19 AC 121 ms
13,868 KB
testcase_20 AC 182 ms
15,876 KB
testcase_21 AC 2 ms
4,384 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include "bits/stdc++.h"
#include <boost/multiprecision/cpp_int.hpp>

#define MOD 1000000007
#define rep(i, n) for(ll i=0; i < (n); i++)
#define rrep(i, n) for(ll i=(n)-1; i >=0; i--)
#define ALL(v) v.begin(),v.end()
#define rALL(v) v.rbegin(),v.rend()
#define FOR(i, j, k) for(ll i=j;i<k;i++)
#define debug_print(var) cerr << #var << "=" << var <<endl;
#define DUMP(i, v)for(ll i=0;i<v.size();i++)cerr<<v[i]<<" "
#define fi first
#define se second

using namespace std;
typedef long long int ll;
typedef vector<ll> llvec;
typedef vector<double> dvec;
typedef pair<ll, ll> P;
typedef long double ld;
struct edge{ll x, c;};

using cpp_int = boost::multiprecision::cpp_int;

/**************************************
** A main function starts from here  **
***************************************/
int main(){
  ll N, K;
  cin >> N >> K;
  vector<cpp_int> A(N);
  rep(i, N)cin >> A[i];

  set<cpp_int> s;
  rep(i, 1<<N){
    cpp_int tmp = 1;
    cpp_int tmp2 = 0;
    ll cnt = 0;
    rep(k, N){
      if(i>>k&1){
        cnt++;
        tmp = tmp*A[k];
        tmp2 = tmp2 + A[k];
      }
    }
    if(cnt>=K){
      s.insert(tmp);
      s.insert(tmp2);
    }
  }
  cout << s.size()<<endl;
  return 0;
}
0