Submission #857527


Source Code Expand

Copy
def solve():
	N,A = map(int,raw_input().split())
	x = map(int,raw_input().split())
	ofs = N*50; M = ofs*2 + 1
	DP = [[0]*M for i in xrange(N+1)]
	DP[0][ofs] = 1
	for i in xrange(N):
		for j in xrange(M):
			if DP[i][j] == 0: continue
			DP[i+1][j+x[i]-A] += DP[i][j]
			DP[i+1][j] += DP[i][j]
	print DP[N][ofs] - 1
solve()

Submission Info

Submission Time
Task C - Tak and Cards
User taktah
Language Python (2.7.6)
Score 300
Code Size 334 Byte
Status AC
Exec Time 67 ms
Memory 4996 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 26 ms 2692 KB
example_02.txt AC 26 ms 2568 KB
example_03.txt AC 26 ms 2692 KB
example_04.txt AC 39 ms 3460 KB
subtask1_01.txt AC 29 ms 2820 KB
subtask1_02.txt AC 29 ms 2820 KB
subtask1_03.txt AC 29 ms 2820 KB
subtask1_04.txt AC 29 ms 2820 KB
subtask1_05.txt AC 30 ms 2820 KB
subtask1_06.txt AC 27 ms 2568 KB
subtask1_07.txt AC 25 ms 2568 KB
subtask1_08.txt AC 29 ms 2820 KB
subtask1_09.txt AC 29 ms 2820 KB
subtask2_01.txt AC 64 ms 4868 KB
subtask2_02.txt AC 67 ms 4996 KB
subtask2_03.txt AC 64 ms 4740 KB
subtask2_04.txt AC 57 ms 4612 KB
subtask2_05.txt AC 57 ms 4612 KB
subtask2_06.txt AC 57 ms 4612 KB
subtask2_07.txt AC 65 ms 4868 KB
subtask2_08.txt AC 47 ms 3716 KB
subtask2_09.txt AC 46 ms 3716 KB
subtask2_10.txt AC 54 ms 4228 KB
subtask2_11.txt AC 55 ms 4356 KB