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

Submission #855238

Source Code Expand

Copy
```#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <numeric>
#include <functional>
#include <cmath>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <sstream>
#include <string>
#define repd(i,a,b) for (int i=(int)(a);i<(int)(b);i++)
#define rep(i,n) repd(i,0,n)
#define all(x) (x).begin(),(x).end()
#define mod 1000000007
#define inf 2000000007
#define mp make_pair
#define pb push_back
typedef long long ll;
using namespace std;
template <typename T>
inline void output(T a, int p) {
if(p) cout << fixed << setprecision(p)  << a << "\n";
else cout << a << "\n";
}
// end of template

int main() {
cin.tie(0);
ios::sync_with_stdio(0);
// source code
int N, A;
cin >> N >> A;
vector<int> X(N);
rep(i, N) cin >> X[i];

vector<vector<ll>> dp(51, vector<ll>(2501, 0));
dp[0][0] = 1;
for(int x: X){
for(int i = 49; i >= 0; i--){
rep(j, 2501){
if(j + x < 2501) dp[i + 1][j + x] += dp[i][j];
}
}
}

ll ret = 0;
repd(i, 1, 51){
ret += dp[i][i * A];
}

output(ret, 0);
return 0;
}```

Submission Info

Submission Time 2016-08-28 21:12:31+0900 C - Tak and Cards ctyl C++14 (GCC 5.4.1) 300 1234 Byte AC 19 ms 1280 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 7 ms 1280 KB
example_02.txt AC 6 ms 1280 KB
example_03.txt AC 8 ms 1280 KB
example_04.txt AC 14 ms 1280 KB
subtask1_01.txt AC 10 ms 1280 KB
subtask1_02.txt AC 10 ms 1280 KB
subtask1_03.txt AC 10 ms 1280 KB
subtask1_04.txt AC 10 ms 1280 KB
subtask1_05.txt AC 10 ms 1280 KB
subtask1_06.txt AC 6 ms 1280 KB
subtask1_07.txt AC 6 ms 1280 KB
subtask1_08.txt AC 10 ms 1280 KB
subtask1_09.txt AC 10 ms 1280 KB
subtask2_01.txt AC 19 ms 1280 KB
subtask2_02.txt AC 19 ms 1280 KB
subtask2_03.txt AC 19 ms 1280 KB
subtask2_04.txt AC 19 ms 1280 KB
subtask2_05.txt AC 19 ms 1280 KB
subtask2_06.txt AC 19 ms 1280 KB
subtask2_07.txt AC 19 ms 1280 KB
subtask2_08.txt AC 14 ms 1280 KB
subtask2_09.txt AC 14 ms 1280 KB
subtask2_10.txt AC 17 ms 1280 KB
subtask2_11.txt AC 17 ms 1280 KB