結果
問題 | No.1463 Hungry Kanten |
ユーザー |
|
提出日時 | 2021-04-02 21:28:28 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
(最新)
AC
(最初)
|
実行時間 | - |
コード長 | 462 bytes |
コンパイル時間 | 1,738 ms |
コンパイル使用メモリ | 174,012 KB |
実行使用メモリ | 15,616 KB |
最終ジャッジ日時 | 2024-12-23 23:17:49 |
合計ジャッジ時間 | 3,046 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 17 WA * 3 |
ソースコード
#include<bits/stdc++.h> using namespace std; #define int long long signed main(){ int N,K;cin>>N>>K; vector<int>vec(N); for(int &i:vec){ cin>>i; } set<int>ans; for(int i=0;i<(1<<N);i++){ int memo=0,sum=0,product=1; for(int j=0;j<N;j++){ if(i&(1<<j)){ memo++; sum+=vec[j]; product*=vec[j]; } } if(memo>=K){ ans.insert(sum); ans.insert(product); } } cout<<ans.size()<<endl; }