Submission #658777

# Submission time Handle Problem Language Result Execution time Memory
658777 2022-11-14T21:39:00 Z beaconmc Ice Hockey World Championship (CEOI15_bobek) PyPy 3
50 / 100
1000 ms 194224 KB
from bisect import *
n,m = map(int, input().split())
lis = list(map(int, input().split()))

a = n//2
b = (n-1)//2 + 1

aa = dict()
bb = dict()

#meet in middle prep

for i in range(2**a):
    cur = 0
    temp = 0
    tempi = i
    while tempi:
        if tempi&1:
            temp += lis[cur]
        cur +=1
        tempi//=2
    if temp in aa:
        aa[temp] += 1
    else:
        aa[temp] = 1

for i in range(2**b):
    cur = a
    temp = 0
    tempi = i
    while tempi:
        if tempi&1:
            temp += lis[cur]
        cur +=1
        tempi//=2
        
    if temp in bb:
        bb[temp] += 1
    else:
        bb[temp] = 1

aa = [[i,aa[i]] for i in aa]
bb = [[i,bb[i]] for i in bb]
aa.sort()
bb.sort()

for i in range(1,len(bb)):
    bb[i][1] += bb[i-1][1]
ans = 0
for i in aa:
    if m-i[0]<0: continue
    
    ans += bb[bisect(bb, [m-i[0], 1000000000])-1][1] * i[1]
print(ans)
# Verdict Execution time Memory Grader output
1 Correct 41 ms 18220 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 42 ms 18216 KB Output is correct
2 Correct 38 ms 18340 KB Output is correct
3 Correct 36 ms 18188 KB Output is correct
4 Correct 34 ms 18220 KB Output is correct
5 Correct 34 ms 18228 KB Output is correct
6 Correct 36 ms 18152 KB Output is correct
7 Correct 35 ms 18168 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 61 ms 19056 KB Output is correct
2 Correct 49 ms 19024 KB Output is correct
3 Correct 52 ms 19328 KB Output is correct
4 Correct 35 ms 18140 KB Output is correct
5 Correct 51 ms 18856 KB Output is correct
6 Correct 64 ms 19896 KB Output is correct
7 Correct 54 ms 18936 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 63 ms 20016 KB Output is correct
2 Correct 56 ms 19732 KB Output is correct
3 Correct 46 ms 19016 KB Output is correct
4 Correct 46 ms 19040 KB Output is correct
5 Correct 52 ms 19524 KB Output is correct
6 Correct 51 ms 19144 KB Output is correct
7 Correct 50 ms 18964 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 186 ms 26168 KB Output is correct
2 Execution timed out 1091 ms 65128 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 261 ms 28252 KB Output is correct
2 Correct 615 ms 38200 KB Output is correct
3 Correct 331 ms 27100 KB Output is correct
4 Correct 35 ms 18188 KB Output is correct
5 Correct 57 ms 19456 KB Output is correct
6 Correct 288 ms 28324 KB Output is correct
7 Correct 561 ms 37088 KB Output is correct
# Verdict Execution time Memory Grader output
1 Execution timed out 1091 ms 58640 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1109 ms 194224 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 955 ms 46932 KB Output is correct
2 Execution timed out 1103 ms 83124 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1093 ms 161988 KB Time limit exceeded
2 Halted 0 ms 0 KB -