結果
問題 | No.1463 Hungry Kanten |
ユーザー |
|
提出日時 | 2024-05-31 23:23:55 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,035 bytes |
コンパイル時間 | 7,970 ms |
コンパイル使用メモリ | 336,468 KB |
実行使用メモリ | 24,192 KB |
最終ジャッジ日時 | 2024-12-21 01:40:31 |
合計ジャッジ時間 | 8,878 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 19 WA * 1 |
ソースコード
#include <bits/stdc++.h>using namespace std;#include <atcoder/all>using namespace atcoder;//using mint = modint1000000007;using mint = modint998244353;template <typename T> bool chmax(T &u, const T z) { if (u < z) {u = z; return true;} else return false; }template <typename T> bool chmin(T &u, const T z) { if (u > z) {u = z; return true;} else return false; }#define ll long long#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)typedef pair<ll, int> P;ll gcd(ll x, ll y) { return y ? gcd(y, x % y) : x; }ll lcm(ll a, ll b){return a * b / gcd(a, b);}int main(){int n,k;cin>>n>>k;vector<ll>a(n);rep(i,n)cin>>a[i];map<__int128,__int128>mp;rep(i,(1<<n)){int bit[20];rep(j,n){bit[j]=(i/(1<<j))%2;}__int128 tmp=0;__int128 tmp_kakeru=1;int cnt=0;rep(j,n){if(bit[j]){tmp+=a[j];tmp_kakeru*=a[j];cnt++;}}if(cnt>=k)mp[tmp]++;if(cnt>=k)mp[tmp_kakeru]++;}ll ans=mp.size();cout<<ans<<endl;return 0;}