結果

問題 No.1463 Hungry Kanten
ユーザー GRMNGRMN
提出日時 2021-05-09 21:17:44
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,164 bytes
コンパイル時間 5,590 ms
コンパイル使用メモリ 265,800 KB
実行使用メモリ 16,012 KB
最終ジャッジ日時 2023-10-19 05:52:12
合計ジャッジ時間 7,252 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,348 KB
testcase_01 AC 2 ms
4,348 KB
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 AC 219 ms
16,012 KB
testcase_06 AC 2 ms
4,348 KB
testcase_07 AC 2 ms
4,348 KB
testcase_08 AC 2 ms
4,348 KB
testcase_09 AC 2 ms
4,348 KB
testcase_10 AC 2 ms
4,348 KB
testcase_11 AC 2 ms
4,348 KB
testcase_12 AC 2 ms
4,348 KB
testcase_13 AC 2 ms
4,348 KB
testcase_14 AC 3 ms
4,348 KB
testcase_15 AC 2 ms
4,348 KB
testcase_16 AC 6 ms
4,348 KB
testcase_17 AC 15 ms
5,088 KB
testcase_18 AC 5 ms
4,348 KB
testcase_19 AC 86 ms
9,940 KB
testcase_20 AC 110 ms
11,184 KB
testcase_21 AC 2 ms
4,348 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
#include <atcoder/all>
using namespace atcoder;
#define rep(i,n) for (int i = 0; i < (n); i++)
#define REP(i,a,b) for(int i=(a);i<(b);i++)
#define all(v) begin(v),end(v)
#define rall(v) rbegin(v),rend(v)
#define fi first
#define se second
#define re0 return 0
template<typename A, typename B> inline bool chmax(A &a, B b) { if (a<b) { a=b; return 1; } return 0; }
template<typename A, typename B> inline bool chmin(A &a, B b) { if (a>b) { a=b; return 1; } return 0; }
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
constexpr ll inf = 2e9;
constexpr ll llinf = 9e18;
//constexpr ll MOD = 998244353;
constexpr ll MOD = 1000000007;
const double pai=acos(-1);

int main() {
    //cout<<fixed<<setprecision(15);
    ll n,k;cin>>n>>k;
    vector<ll> a(n);
    rep(i,n)cin>>a[i];
    set<ll> st;
    rep(bit,1<<n){
        if(__builtin_popcount(bit)<k)continue;
        ll wa=0,seki=1;
        rep(i,n){
            if(bit&(ll)(1<<i)){
                wa+=a[i];
                seki*=a[i];
            }
        }
        st.insert(wa);
        st.insert(seki);
    }
    cout<<st.size()<<endl;
}
0