Submission #856415


Source Code Expand

Copy
n,a=map(int,raw_input().split())
x=map(int,raw_input().split())
x.sort()
dp=[[[0]*(n+1) for i in xrange(n*a+1)] for j in xrange(n+1)]
for i in xrange(n+1):
    dp[i][0][0]=1
ans=0
for i in xrange(n):
    for j in xrange(1,n*a+1):
        for k in xrange(1,n+1):
            if i+1<k:break
            if j<x[i]:
                dp[i+1][j][k]=dp[i][j][k]
                continue
            dp[i+1][j][k]=dp[i][j][k]+dp[i][j-x[i]][k-1]
for j in xrange(1,n*a+1):
    for k in xrange(1,n+1):
        if j==a*k:
            ans+=dp[n][j][k]
print(ans)

Submission Info

Submission Time
Task C - Tak and Cards
User yugamiakira
Language PyPy2 (5.6.0)
Score 300
Code Size 567 Byte
Status AC
Exec Time 423 ms
Memory 81820 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 63 ms 8944 KB
example_02.txt AC 58 ms 8944 KB
example_03.txt AC 92 ms 11248 KB
example_04.txt AC 98 ms 12656 KB
subtask1_01.txt AC 104 ms 14960 KB
subtask1_02.txt AC 115 ms 15600 KB
subtask1_03.txt AC 64 ms 9328 KB
subtask1_04.txt AC 100 ms 14960 KB
subtask1_05.txt AC 97 ms 13680 KB
subtask1_06.txt AC 56 ms 8944 KB
subtask1_07.txt AC 57 ms 8944 KB
subtask1_08.txt AC 102 ms 14064 KB
subtask1_09.txt AC 81 ms 10480 KB
subtask2_01.txt AC 272 ms 51100 KB
subtask2_02.txt AC 366 ms 69532 KB
subtask2_03.txt AC 266 ms 49692 KB
subtask2_04.txt AC 423 ms 81820 KB
subtask2_05.txt AC 83 ms 11376 KB
subtask2_06.txt AC 405 ms 81052 KB
subtask2_07.txt AC 269 ms 49564 KB
subtask2_08.txt AC 202 ms 36252 KB
subtask2_09.txt AC 225 ms 38684 KB
subtask2_10.txt AC 137 ms 21616 KB
subtask2_11.txt AC 174 ms 33948 KB