結果
| 問題 |
No.1463 Hungry Kanten
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2021-04-02 22:06:45 |
| 言語 | C++17(clang) (17.0.6 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 228 ms / 2,000 ms |
| コード長 | 868 bytes |
| コンパイル時間 | 6,882 ms |
| コンパイル使用メモリ | 229,420 KB |
| 実行使用メモリ | 33,152 KB |
| 最終ジャッジ日時 | 2025-06-20 01:33:33 |
| 合計ジャッジ時間 | 7,950 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 24 |
ソースコード
#include <algorithm>
#include <boost/multiprecision/cpp_dec_float.hpp>
#include <boost/multiprecision/cpp_int.hpp>
#include <cmath>
#include <cstdio>
#include <functional>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
namespace mp = boost::multiprecision;
using Bint = mp::cpp_int;
using namespace std;
using ll = long long;
int main() {
int n, k;
cin >> n >> k;
vector<Bint> a(n);
map<Bint, Bint> mp;
for(int i = 0; i < n; i++) {
cin >> a[i];
}
for(int bit = 0; bit < (1 << n); bit++) {
int cnt = 0;
Bint s = 0, m = 1;
for(int i = 0; i < n; i++) {
if(bit & (1 << i)) {
cnt++;
s += a[i];
m *= a[i];
}
}
if(cnt >= k) {
mp[s]++;
mp[m]++;
}
}
cout << mp.size() << endl;
return 0;
}