結果
| 問題 | No.1463 Hungry Kanten |
| コンテスト | |
| ユーザー |
DaYuanChi
|
| 提出日時 | 2021-04-02 21:34:45 |
| 言語 | C++14 (gcc 15.2.0 + boost 1.89.0) |
| 結果 |
WA
(最新)
AC
(最初)
|
| 実行時間 | - |
| コード長 | 498 bytes |
| 記録 | |
| コンパイル時間 | 1,654 ms |
| コンパイル使用メモリ | 186,464 KB |
| 実行使用メモリ | 16,000 KB |
| 最終ジャッジ日時 | 2026-05-29 21:03:43 |
| 合計ジャッジ時間 | 2,604 ms |
|
ジャッジサーバーID (参考情報) |
judge2_0 / judge4_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 17 WA * 7 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main(){
int n, k; cin >> n >> k;
vector<ll> a(n);
set<ll> st;
for(int i = 0; i < n; i++) cin >> a[i];
for(int bit = 0; bit < (1<<n); bit++){
ll sum = 0;
ll pro = 1;
if(__builtin_popcount (bit)<k) continue;
for(int j = 0; j < n; j++){
if(bit&(1<<j)){
sum += a[j];
pro *= a[j];
}
}
st.insert(sum);
st.insert(pro);
}
cout << st.size() << endl;
return 0;
}
DaYuanChi