Submission #855206


Source Code Expand

Copy
#include <bits/stdc++.h>

#define x first
#define y second

using namespace std;

typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int,int> ii;
typedef pair<ll,ll> pll;

ll dp[51][51][2501];
int N,A;

int main() {
	cin >> N >> A;
	dp[0][0][0]=1;
	for (int i=0;i<N;i++) {
		int ai;cin >> ai;
		for (int j=0;j+ai<=2500;j++) for (int k=0;k<50;k++) {
			dp[i+1][k][j]+=dp[i][k][j];
			dp[i+1][k+1][j+ai]+=dp[i][k][j];
		}
	}

	ll r=0;
	for (int num=1;num<=N;num++) r+=dp[N][num][num*A];
	cout << r << endl;
}

Submission Info

Submission Time
Task C - Tak and Cards
User Whalanator
Language C++14 (GCC 5.4.1)
Score 300
Code Size 593 Byte
Status AC
Exec Time 104 ms
Memory 50048 KB

Judge Result

Set Name Sample Subtask1 All
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
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 12 ms 4224 KB
example_02.txt AC 10 ms 3200 KB
example_03.txt AC 20 ms 8192 KB
example_04.txt AC 63 ms 33152 KB
subtask1_01.txt AC 33 ms 16128 KB
subtask1_02.txt AC 36 ms 16128 KB
subtask1_03.txt AC 36 ms 16128 KB
subtask1_04.txt AC 33 ms 16128 KB
subtask1_05.txt AC 36 ms 16128 KB
subtask1_06.txt AC 6 ms 1280 KB
subtask1_07.txt AC 7 ms 1280 KB
subtask1_08.txt AC 36 ms 16128 KB
subtask1_09.txt AC 31 ms 15232 KB
subtask2_01.txt AC 104 ms 50048 KB
subtask2_02.txt AC 103 ms 50048 KB
subtask2_03.txt AC 101 ms 49024 KB
subtask2_04.txt AC 93 ms 50048 KB
subtask2_05.txt AC 104 ms 50048 KB
subtask2_06.txt AC 92 ms 50048 KB
subtask2_07.txt AC 103 ms 50048 KB
subtask2_08.txt AC 70 ms 33152 KB
subtask2_09.txt AC 70 ms 33152 KB
subtask2_10.txt AC 77 ms 41088 KB
subtask2_11.txt AC 93 ms 43136 KB