Submission #855923


Source Code Expand

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

typedef pair<int,int> pii;
typedef long long ll;
typedef vector<int> vi;

#define rep(i,j) for(int i=0;i<(j);i++)
#define reps(i,j,k) for(int i=j;i<=k;i++)
#define in(i,j,k) ((i)>=(j)&&(i)<=(k))
#define INF (1<<28)
#define pb(i) push_back(i)
#define fs first
#define sc second

const char dx[]={0,1,0,-1},dy[]={1,0,-1,0};

ll dp[51][51][2501];

int main(){
	int n,a;
	cin >> n >> a;
	vi v(n);
	rep(i,n)cin >> v[i];
//	rep(i,n) cout << v[i] <<endl;
	dp[0][0][0] = 1;
	reps(i,1,n){
		rep(j,i){
			rep(k,50*n){
					dp[i][j][k] += dp[i-1][j][k];
					if(k+v[i-1]<2501) dp[i][j+1][k+v[i-1]] += dp[i-1][j][k];
			}
		}
	}
	int cnt = 0;
	reps(j,1,n){
		cnt += dp[n][j][a*j];
	}
	cout << cnt << endl;
	return 0;
}

Submission Info

Submission Time
Task C - Tak and Cards
User musasabi
Language C++14 (GCC 5.4.1)
Score 200
Code Size 794 Byte
Status WA
Exec Time 48 ms
Memory 26368 KB

Judge Result

Set Name Sample Subtask1 All
Score / Max Score 0 / 0 200 / 200 0 / 100
Status
AC × 3
WA × 1
AC × 12
AC × 19
WA × 5
Set Name Test Cases
Sample example_01.txt, example_02.txt, example_03.txt, example_04.txt
Subtask1 example_01.txt, example_02.txt, example_03.txt, subtask1_01.txt, subtask1_02.txt, subtask1_03.txt, subtask1_04.txt, subtask1_05.txt, subtask1_06.txt, subtask1_07.txt, subtask1_08.txt, subtask1_09.txt
All example_01.txt, example_02.txt, example_03.txt, example_04.txt, subtask1_01.txt, subtask1_02.txt, subtask1_03.txt, subtask1_04.txt, subtask1_05.txt, subtask1_06.txt, subtask1_07.txt, subtask1_08.txt, subtask1_09.txt, subtask2_01.txt, subtask2_02.txt, subtask2_03.txt, subtask2_04.txt, subtask2_05.txt, subtask2_06.txt, subtask2_07.txt, subtask2_08.txt, subtask2_09.txt, subtask2_10.txt, subtask2_11.txt
Case Name Status Exec Time Memory
example_01.txt AC 4 ms 256 KB
example_02.txt AC 4 ms 256 KB
example_03.txt AC 4 ms 512 KB
example_04.txt WA 20 ms 10240 KB
subtask1_01.txt AC 6 ms 1792 KB
subtask1_02.txt AC 6 ms 1792 KB
subtask1_03.txt AC 6 ms 1792 KB
subtask1_04.txt AC 6 ms 1792 KB
subtask1_05.txt AC 6 ms 1792 KB
subtask1_06.txt AC 4 ms 256 KB
subtask1_07.txt AC 4 ms 256 KB
subtask1_08.txt AC 6 ms 1792 KB
subtask1_09.txt AC 6 ms 1536 KB
subtask2_01.txt WA 47 ms 26368 KB
subtask2_02.txt AC 47 ms 26368 KB
subtask2_03.txt WA 45 ms 25344 KB
subtask2_04.txt WA 47 ms 26368 KB
subtask2_05.txt AC 47 ms 26368 KB
subtask2_06.txt AC 48 ms 26368 KB
subtask2_07.txt AC 47 ms 26368 KB
subtask2_08.txt AC 20 ms 10368 KB
subtask2_09.txt AC 20 ms 10368 KB
subtask2_10.txt AC 32 ms 17920 KB
subtask2_11.txt WA 35 ms 19584 KB