Contest Duration: - (local time) (100 minutes) Back to Home

Submission #855185

Source Code Expand

Copy
```#include <algorithm>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <iostream>
#include <map>
#include <memory>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <list>

using namespace std;

typedef long long ll;

#define sz size()
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define all(c) (c).begin(), (c).end()
#define rep(i,a,b) for(ll i=(a);i<(b);++i)
#define clr(a, b) memset((a), (b) ,sizeof(a))
#define ctos(d) string(1,d)
#define print(x) cout<<#x<<" = "<<x<<endl;

#define MOD 1000000007

ll dp[55][3000][55];

int main() {
ll n,a;
cin>>n>>a;
vector<ll> v;
rep(i,0,n){
ll b;
cin>>b;
v.pb(b);
}
clr(dp,0);
dp[0][0][0] = 1;
rep(i,1,n+1){
rep(j,0,2700){
rep(k,0,52){
// use
dp[i][j+v[i-1]][k+1] += dp[i-1][j][k];
// not use
dp[i][j][k] += dp[i-1][j][k];
}
}
}
ll ans = 0;
rep(i,0,2700){
rep(j,1,52){
if(i%j==0&&i/j==a){
ans += dp[n][i][j];
}
}
}
printf("%lld\n", ans);
return 0;
}```

#### Submission Info

Submission Time 2016-08-28 21:10:52+0900 C - Tak and Cards nmnmnmnmnmnmnm C++14 (GCC 5.4.1) 300 1307 Byte AC 149 ms 71168 KB

#### Judge Result

Score / Max Score 0 / 0 200 / 200 100 / 100
Status
 AC × 4
 AC × 12
 AC × 24
Set Name Test Cases
Sample example_01.txt, example_02.txt, example_03.txt, example_04.txt
Case Name Status Exec Time Memory
example_01.txt AC 117 ms 71168 KB
example_02.txt AC 113 ms 71168 KB
example_03.txt AC 111 ms 71168 KB
example_04.txt AC 125 ms 71168 KB
subtask1_01.txt AC 124 ms 71168 KB
subtask1_02.txt AC 114 ms 71168 KB
subtask1_03.txt AC 115 ms 71168 KB
subtask1_04.txt AC 121 ms 71168 KB
subtask1_05.txt AC 130 ms 71168 KB
subtask1_06.txt AC 119 ms 71168 KB
subtask1_07.txt AC 119 ms 71168 KB
subtask1_08.txt AC 115 ms 71168 KB
subtask1_09.txt AC 129 ms 71168 KB
subtask2_01.txt AC 148 ms 71168 KB
subtask2_02.txt AC 135 ms 71168 KB
subtask2_03.txt AC 148 ms 71168 KB
subtask2_04.txt AC 139 ms 71168 KB
subtask2_05.txt AC 133 ms 71168 KB
subtask2_06.txt AC 149 ms 71168 KB
subtask2_07.txt AC 149 ms 71168 KB
subtask2_08.txt AC 141 ms 71168 KB
subtask2_09.txt AC 140 ms 71168 KB
subtask2_10.txt AC 134 ms 71168 KB
subtask2_11.txt AC 130 ms 71168 KB