Submission #855145


Source Code Expand

Copy
#include <cmath>
#include <vector>
#include <iostream>
#include <limits>
#include <iostream>
#include <vector>
#include <cassert>
#include <complex>
#include <cstring>
#include <map>
#include <cmath>
#include <set>
#include <algorithm>
#include <queue>

using namespace std;
typedef long long Long;

vector<int> V;
Long mem[51][3010][51];
Long dp(int id, int sum, int cnt, int S){
	if(id == V.size())return cnt && sum == S * cnt;
	if(mem[id][sum][cnt] != -1)return mem[id][sum][cnt]; 
	Long w = dp(id+1,sum,cnt, S) + dp(id+1, sum + V[id], cnt+1, S);
	return mem[id][sum][cnt] = w;
}

int main(){

	memset(mem,-1,sizeof(mem));
	int N , S;
	cin >> N >> S;
	V = vector<int>(N);
	for(int &v : V)
		cin >> v;
	cout << dp(0, 0, 0, S) << endl;
	
}


/*




 */

Submission Info

Submission Time
Task C - Tak and Cards
User cjtoribio
Language C++14 (GCC 5.4.1)
Score 300
Code Size 800 Byte
Status AC
Exec Time 128 ms
Memory 61440 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 114 ms 61440 KB
example_02.txt AC 114 ms 61440 KB
example_03.txt AC 114 ms 61440 KB
example_04.txt AC 114 ms 61440 KB
subtask1_01.txt AC 101 ms 61440 KB
subtask1_02.txt AC 101 ms 61440 KB
subtask1_03.txt AC 101 ms 61440 KB
subtask1_04.txt AC 115 ms 61440 KB
subtask1_05.txt AC 114 ms 61440 KB
subtask1_06.txt AC 125 ms 61440 KB
subtask1_07.txt AC 118 ms 61440 KB
subtask1_08.txt AC 108 ms 61440 KB
subtask1_09.txt AC 102 ms 61440 KB
subtask2_01.txt AC 127 ms 61440 KB
subtask2_02.txt AC 114 ms 61440 KB
subtask2_03.txt AC 128 ms 61440 KB
subtask2_04.txt AC 115 ms 61440 KB
subtask2_05.txt AC 114 ms 61440 KB
subtask2_06.txt AC 102 ms 61440 KB
subtask2_07.txt AC 115 ms 61440 KB
subtask2_08.txt AC 105 ms 61440 KB
subtask2_09.txt AC 118 ms 61440 KB
subtask2_10.txt AC 108 ms 61440 KB
subtask2_11.txt AC 123 ms 61440 KB