結果
| 問題 | No.1463 Hungry Kanten |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2021-04-02 22:06:45 |
| 言語 | C++17(clang) (clang++ 22.1.2 + boost 1.90.0) |
| 結果 |
AC
|
| 実行時間 | 178 ms / 2,000 ms |
| + 665µs | |
| コード長 | 868 bytes |
| 記録 | |
| コンパイル時間 | 5,488 ms |
| コンパイル使用メモリ | 236,100 KB |
| 実行使用メモリ | 33,408 KB |
| 最終ジャッジ日時 | 2026-07-12 08:58:44 |
| 合計ジャッジ時間 | 6,442 ms |
|
ジャッジサーバーID (参考情報) |
judge1_1 / judge3_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| 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;
}