Submission #854917


Source Code Expand

Copy
#include <bits/stdc++.h>
using namespace std;
typedef signed long long ll;

#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define FOR(x,to) for(x=0;x<(to);x++)
#define FORR(x,arr) for(auto& x:arr)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
//-------------------------------------------------------

int N,A;
ll dp[51][55][2555];

void solve() {
	int i,j,k,l,r,x,y; string s;
	
	cin>>N>>A;
	dp[0][0][0]=1;
	FOR(i,N) {
		cin>>x;
		memmove(dp[i+1],dp[i],sizeof(dp[i]));
		FOR(j,i+1) FOR(y,2500) dp[i+1][j+1][y+x] += dp[i][j][y];
	}
	
	ll ret=0;
	FOR(x,51) ret+=dp[N][x+1][(x+1)*A];
	cout<<ret<<endl;
	
}


int main(int argc,char** argv){
	string s;int i;
	if(argc==1) ios::sync_with_stdio(false), cin.tie(0);
	FOR(i,argc-1) s+=argv[i+1],s+='\n';
	FOR(i,s.size()) ungetc(s[s.size()-1-i],stdin);
	solve(); return 0;
}

Submission Info

Submission Time
Task C - Tak and Cards
User kmjp
Language C++14 (GCC 5.4.1)
Score 300
Code Size 1004 Byte
Status AC
Exec Time 126 ms
Memory 55168 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 13 ms 4608 KB
example_02.txt AC 11 ms 3584 KB
example_03.txt AC 24 ms 9088 KB
example_04.txt AC 84 ms 36480 KB
subtask1_01.txt AC 43 ms 17792 KB
subtask1_02.txt AC 43 ms 17792 KB
subtask1_03.txt AC 43 ms 17792 KB
subtask1_04.txt AC 43 ms 17792 KB
subtask1_05.txt AC 43 ms 17792 KB
subtask1_06.txt AC 7 ms 1408 KB
subtask1_07.txt AC 7 ms 1408 KB
subtask1_08.txt AC 43 ms 17792 KB
subtask1_09.txt AC 40 ms 16768 KB
subtask2_01.txt AC 126 ms 55168 KB
subtask2_02.txt AC 126 ms 55168 KB
subtask2_03.txt AC 123 ms 54016 KB
subtask2_04.txt AC 125 ms 55168 KB
subtask2_05.txt AC 125 ms 55168 KB
subtask2_06.txt AC 125 ms 55168 KB
subtask2_07.txt AC 115 ms 55168 KB
subtask2_08.txt AC 77 ms 36480 KB
subtask2_09.txt AC 84 ms 36480 KB
subtask2_10.txt AC 94 ms 45312 KB
subtask2_11.txt AC 108 ms 47488 KB