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

Submission #856133

Source Code Expand

Copy
```#include <bits/stdc++.h>
using namespace std;

#define in cin
#define out cout

#define REP(i,n) for(int i=0; i<n; i++)
#define REP2(i,s,e) for(int i=s; i<e; i++)
#define REPE(i,s,e) for(register int i=s; i<=e; i++)
#define REPR(i,s,e) for(int i=s; i>=e; i--)

#define all(v) v.begin(), v.end()
#define pb push_back

#define ll long long
#define pii pair<int, int>
#define pll pair<ll, int>
#define rd(n) scanf("%d", &n)

#define x first
#define y second
#define intINF 2147483647
#define llINF 9223372036854775807LL
#define MOD 1000000007

#define mx 51

int main()
{
int n, a; in >> n >> a;
ll dp[mx][mx][mx*mx]; memset(dp, 0, sizeof(dp));

int x[55];
REP(i, n) in >> x[i];
int sum = x[0];
dp[0][0][0] = 1;
dp[0][1][x[0]] = 1;

REP2(i, 1, n)
{
sum += x[i];
REPE(j, 0, i+1)
{
REPE(k, 0, sum)
{
dp[i][j][k] += dp[i-1][j][k];
if(k-x[i] >= 0 && j) dp[i][j][k] += dp[i-1][j-1][k-x[i]];
}
}
}

ll res = 0;
REPE(i, 1, n) res += dp[n-1][i][a*i];
out << res << "\n";

return 0;
}
```

Submission Info

Submission Time 2016-08-28 21:48:19+0900 C - Tak and Cards exqt C++14 (GCC 5.4.1) 300 1186 Byte AC 101 ms 53120 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 75 ms 53120 KB
example_02.txt AC 78 ms 53120 KB
example_03.txt AC 87 ms 53120 KB
example_04.txt AC 77 ms 53120 KB
subtask1_01.txt AC 88 ms 53120 KB
subtask1_02.txt AC 84 ms 53120 KB
subtask1_03.txt AC 77 ms 53120 KB
subtask1_04.txt AC 101 ms 53120 KB
subtask1_05.txt AC 75 ms 53120 KB
subtask1_06.txt AC 76 ms 53120 KB
subtask1_07.txt AC 76 ms 53120 KB
subtask1_08.txt AC 77 ms 53120 KB
subtask1_09.txt AC 86 ms 53120 KB
subtask2_01.txt AC 80 ms 53120 KB
subtask2_02.txt AC 80 ms 53120 KB
subtask2_03.txt AC 90 ms 53120 KB
subtask2_04.txt AC 93 ms 53120 KB
subtask2_05.txt AC 93 ms 53120 KB
subtask2_06.txt AC 88 ms 53120 KB
subtask2_07.txt AC 90 ms 53120 KB
subtask2_08.txt AC 78 ms 53120 KB
subtask2_09.txt AC 88 ms 53120 KB
subtask2_10.txt AC 90 ms 53120 KB
subtask2_11.txt AC 79 ms 53120 KB