結果
| 問題 |
No.1463 Hungry Kanten
|
| コンテスト | |
| ユーザー |
umezo
|
| 提出日時 | 2021-04-03 01:40:16 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 227 ms / 2,000 ms |
| コード長 | 645 bytes |
| コンパイル時間 | 4,685 ms |
| コンパイル使用メモリ | 394,156 KB |
| 実行使用メモリ | 24,960 KB |
| 最終ジャッジ日時 | 2025-06-20 01:35:03 |
| 合計ジャッジ時間 | 6,017 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 24 |
ソースコード
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define ALL(v) v.begin(),v.end()
typedef long long ll;
#include<bits/stdc++.h>
using namespace std;
#include <boost/multiprecision/cpp_int.hpp>
namespace mp = boost::multiprecision;
using Bint = mp::cpp_int;
int main(){
int n,k;
cin>>n>>k;
vector<Bint> A(n);
rep(i,n) cin>>A[i];
set<Bint> s;
for(int bit=0;bit<(1<<n);bit++){
if(__builtin_popcount(bit)<k) continue;
Bint sum=0;
Bint mul=1;
for(int i=0;i<n;i++){
if(bit&(1<<i)){
sum+=A[i];
mul*=A[i];
}
}
s.insert(sum);
s.insert(mul);
}
cout<<s.size()<<endl;
return 0;
}
umezo