Submission #65032637


Source Code Expand

Copy
def li():
return list(map(int, input().split()))
import sys
sys.setrecursionlimit(10**6)
import pypyjit
pypyjit.set_param('max_unroll_recursion=-1')
n,x=li()
scp=[li() for _ in range(n)]
dp=[[-1]*(x+1) for _ in range(1<<n)]
rr=[0]*(1<<n)
for i in range(1<<n):
tmp=0
for j in range(n):
if (i>>j)&1:
tmp+=scp[j][0]
rr[i]=tmp
def solve(state,val):
if dp[state][val]!=-1:return dp[state][val]
res=rr[state]
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
def li():
    return list(map(int, input().split()))
import sys
sys.setrecursionlimit(10**6)
import pypyjit
pypyjit.set_param('max_unroll_recursion=-1')

n,x=li()
scp=[li() for _ in range(n)]
dp=[[-1]*(x+1) for _ in range(1<<n)]
rr=[0]*(1<<n)
for i in range(1<<n):
    tmp=0
    for j in range(n):
        if (i>>j)&1:
            tmp+=scp[j][0]
    rr[i]=tmp
    
def solve(state,val):
    if dp[state][val]!=-1:return dp[state][val]
    res=rr[state]
    for i in range(n):
        if (state>>i)&1:
            continue
        if val-scp[i][1]<0:continue
        nxt=state+(1<<i)
        tmp=(scp[i][2]/100)*solve(nxt,val-scp[i][1])+(1-scp[i][2]/100)*solve(state,val-scp[i][1])
        res=max(res,tmp)
    dp[state][val]=res
    return res
print(solve(0,x))

Submission Info

Submission Time
Task E - Payment Required
User juntenbanana
Language Python (PyPy 3.10-v7.3.12)
Score 450
Code Size 791 Byte
Status AC
Exec Time 727 ms
Memory 138980 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 450 / 450
Status
AC × 4
AC × 43
Set Name Test Cases
Sample 00_sample_00.txt, 00_sample_01.txt, 00_sample_02.txt, 00_sample_03.txt
All 00_sample_00.txt, 00_sample_01.txt, 00_sample_02.txt, 00_sample_03.txt, 01_handmade_00.txt, 01_handmade_01.txt, 01_handmade_02.txt, 01_handmade_03.txt, 01_handmade_04.txt, 01_handmade_05.txt, 02_random_00.txt, 02_random_01.txt, 02_random_02.txt, 02_random_03.txt, 02_random_04.txt, 02_random_05.txt, 02_random_06.txt, 02_random_07.txt, 02_random_08.txt, 02_random_09.txt, 02_random_10.txt, 02_random_11.txt, 02_random_12.txt, 02_random_13.txt, 02_random_14.txt, 02_random_15.txt, 02_random_16.txt, 02_random_17.txt, 02_random_18.txt, 02_random_19.txt, 02_random_20.txt, 02_random_21.txt, 02_random_22.txt, 02_random_23.txt, 02_random_24.txt, 02_random_25.txt, 02_random_26.txt, 02_random_27.txt, 02_random_28.txt, 02_random_29.txt, 02_random_30.txt, 02_random_31.txt, 02_random_32.txt
Case Name Status Exec Time Memory
00_sample_00.txt AC 54 ms 76512 KB
00_sample_01.txt AC 55 ms 76596 KB
00_sample_02.txt AC 64 ms 82080 KB
00_sample_03.txt AC 81 ms 83436 KB
01_handmade_00.txt AC 55 ms 76592 KB
01_handmade_01.txt AC 55 ms 76456 KB
01_handmade_02.txt AC 72 ms 84936 KB
01_handmade_03.txt AC 72 ms 85080 KB
01_handmade_04.txt AC 710 ms 138980 KB
01_handmade_05.txt AC 713 ms 138912 KB
02_random_00.txt AC 56 ms 76740 KB
02_random_01.txt AC 55 ms 76344 KB
02_random_02.txt AC 59 ms 81268 KB
02_random_03.txt AC 54 ms 76672 KB
02_random_04.txt AC 55 ms 76580 KB
02_random_05.txt AC 119 ms 96372 KB
02_random_06.txt AC 103 ms 91736 KB
02_random_07.txt AC 88 ms 86452 KB
02_random_08.txt AC 148 ms 99308 KB
02_random_09.txt AC 55 ms 76596 KB
02_random_10.txt AC 59 ms 81440 KB
02_random_11.txt AC 65 ms 81828 KB
02_random_12.txt AC 156 ms 105020 KB
02_random_13.txt AC 55 ms 76364 KB
02_random_14.txt AC 59 ms 81536 KB
02_random_15.txt AC 55 ms 76528 KB
02_random_16.txt AC 58 ms 81372 KB
02_random_17.txt AC 54 ms 76484 KB
02_random_18.txt AC 59 ms 81620 KB
02_random_19.txt AC 81 ms 85332 KB
02_random_20.txt AC 396 ms 117580 KB
02_random_21.txt AC 55 ms 76532 KB
02_random_22.txt AC 59 ms 81764 KB
02_random_23.txt AC 55 ms 76632 KB
02_random_24.txt AC 76 ms 93308 KB
02_random_25.txt AC 91 ms 86788 KB
02_random_26.txt AC 711 ms 119392 KB
02_random_27.txt AC 98 ms 87932 KB
02_random_28.txt AC 695 ms 138560 KB
02_random_29.txt AC 83 ms 85636 KB
02_random_30.txt AC 711 ms 125396 KB
02_random_31.txt AC 92 ms 86796 KB
02_random_32.txt AC 727 ms 120172 KB


2025-04-26 (Sat)
20:50:23 +09:00