結果
| 問題 |
No.1463 Hungry Kanten
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2021-04-02 23:21:38 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
(最新)
AC
(最初)
|
| 実行時間 | - |
| コード長 | 550 bytes |
| コンパイル時間 | 1,649 ms |
| コンパイル使用メモリ | 171,728 KB |
| 実行使用メモリ | 19,840 KB |
| 最終ジャッジ日時 | 2024-12-23 23:41:47 |
| 合計ジャッジ時間 | 2,493 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 19 WA * 1 |
ソースコード
#include<bits/stdc++.h>
#define rep(i, s, n) for (long long i=s;i<(long long)(n);i++)
using namespace std;
int main(){
int n,k;
cin>>n>>k;
int a[n];
rep(i,0,n){
cin>>a[i];
}
set<__int128>s;
rep(i,(1<<k)-1,(1<<n)){
__int128 sum=0,cnt=0,pro=1;
rep(j,0,n){
if((1<<j)&i){
cnt++;
sum+=a[j];
pro*=a[j];
}
}
if(cnt>=k){
s.insert(sum);
s.insert(pro);
}
}
cout<<s.size()<<endl;
}