Submission #1381023


Source Code Expand

import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools

sys.setrecursionlimit(10**7)
inf = 10**20
mod = 10**9 + 7

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()


def main():
    N,X = LI()
    W = sorted([I() for _ in range(N)], reverse=True)
    d = collections.defaultdict(int)
    d[0] = 1
    for c in W:
        t = collections.defaultdict(int)
        for k,v in d.items():
            if k+c > X:
                continue
            t[k+c] += v
        for k,v in t.items():
            d[k] += v

    return d[X]


print(main())






Submission Info

Submission Time
Task C - 無駄なものが嫌いな人
User iehn
Language Python (3.4.3)
Score 0
Code Size 940 Byte
Status TLE
Exec Time 2112 ms
Memory 283676 KB

Judge Result

Set Name All
Score / Max Score 0 / 100
Status
AC × 21
TLE × 7
Set Name Test Cases
All max_1.txt, max_2.txt, max_3.txt, max_4.txt, pair_1.txt, pair_2.txt, power2_1.txt, power2_2.txt, power2_3.txt, power2_4.txt, power2_5.txt, random_1.txt, random_2.txt, random_3.txt, random_4.txt, random_5.txt, random_6.txt, random_7.txt, random_8.txt, random_9.txt, sample_1.txt, sample_2.txt, sample_3.txt, sample_4.txt, small_1.txt, small_2.txt, small_3.txt, small_4.txt
Case Name Status Exec Time Memory
max_1.txt AC 41 ms 5456 KB
max_2.txt AC 56 ms 6228 KB
max_3.txt AC 41 ms 5456 KB
max_4.txt AC 43 ms 5460 KB
pair_1.txt TLE 2108 ms 260248 KB
pair_2.txt AC 51 ms 5964 KB
power2_1.txt TLE 2112 ms 242020 KB
power2_2.txt AC 69 ms 9300 KB
power2_3.txt AC 41 ms 5460 KB
power2_4.txt AC 41 ms 5328 KB
power2_5.txt TLE 2110 ms 279972 KB
random_1.txt TLE 2110 ms 260884 KB
random_2.txt TLE 2110 ms 283676 KB
random_3.txt AC 459 ms 70036 KB
random_4.txt TLE 2110 ms 265816 KB
random_5.txt AC 44 ms 5460 KB
random_6.txt AC 50 ms 5712 KB
random_7.txt AC 64 ms 6600 KB
random_8.txt AC 274 ms 16780 KB
random_9.txt TLE 2109 ms 253152 KB
sample_1.txt AC 41 ms 5456 KB
sample_2.txt AC 40 ms 5456 KB
sample_3.txt AC 45 ms 5968 KB
sample_4.txt AC 41 ms 5332 KB
small_1.txt AC 41 ms 5460 KB
small_2.txt AC 41 ms 5332 KB
small_3.txt AC 40 ms 5328 KB
small_4.txt AC 40 ms 5328 KB