結果
問題 | No.1463 Hungry Kanten |
ユーザー |
|
提出日時 | 2024-04-29 11:23:06 |
言語 | C++17(gcc12) (gcc 12.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 222 ms / 2,000 ms |
コード長 | 719 bytes |
コンパイル時間 | 9,015 ms |
コンパイル使用メモリ | 403,032 KB |
実行使用メモリ | 24,960 KB |
最終ジャッジ日時 | 2024-11-18 14:23:18 |
合計ジャッジ時間 | 10,600 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 20 |
ソースコード
#include <bits/stdc++.h>#include <boost/multiprecision/cpp_int.hpp>#include <atcoder/all>using namespace std;using namespace atcoder;namespace mul = boost::multiprecision;using ll = long long;using ld = long double;using mint = modint998244353;int main() {int N, M, K, ans = 0;mul::cpp_int x, y;cin >> N >> K;M = 1 << N;vector<int> A(N);set<mul::cpp_int> st;for (int i = 0; i < N; i++) cin >> A[i];for (int i = 0; i < M; i++) {if (__builtin_popcount(i) < K) continue;x = 0, y = 1;for (int j = 0; j < N; j++) {if (i >> j & 1) {x += A[j];y *= A[j];}}st.insert(x);st.insert(y);}cout << st.size() << endl;return 0;}