結果
問題 |
No.1463 Hungry Kanten
|
ユーザー |
![]() |
提出日時 | 2023-06-19 16:09:35 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 190 ms / 2,000 ms |
コード長 | 682 bytes |
コンパイル時間 | 3,898 ms |
コンパイル使用メモリ | 384,768 KB |
実行使用メモリ | 24,960 KB |
最終ジャッジ日時 | 2025-06-20 01:42:34 |
合計ジャッジ時間 | 5,342 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 24 |
ソースコード
#include <bits/stdc++.h> #include <boost/multiprecision/cpp_int.hpp> using namespace std; using ll = long long; namespace mul = boost::multiprecision; 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 (1<<j & i){ x += A[j]; y *= A[j]; } } st.insert(x); st.insert(y); } cout << st.size() << endl; return 0; }