Submission #65031584
Source Code Expand
Copy
def li():return list(map(int, input().split()))import syssys.setrecursionlimit(10**6)import pypyjitpypyjit.set_param('max_unroll_recursion=-1')n,x=li()scp=[li() for _ in range(n)]dp={}rr=[0]*(1<<n)for i in range(1<<n):tmp=0for j in range(n):if (i>>j)&1:tmp+=scp[j][0]rr[i]=tmpdef solve(state,val):if (state,val) in dp:return dp[(state,val)]res=rr[state]
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={}
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 (state,val) in dp: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 | 0 |
| Code Size | 761 Byte |
| Status | TLE |
| Exec Time | 2226 ms |
| Memory | 330052 KB |
Judge Result
| Set Name | Sample | All | ||||||
|---|---|---|---|---|---|---|---|---|
| Score / Max Score | 0 / 0 | 0 / 450 | ||||||
| Status |
|
|
| 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 | 55 ms | 76416 KB |
| 00_sample_01.txt | AC | 55 ms | 76548 KB |
| 00_sample_02.txt | AC | 63 ms | 81860 KB |
| 00_sample_03.txt | AC | 83 ms | 83848 KB |
| 01_handmade_00.txt | AC | 55 ms | 76792 KB |
| 01_handmade_01.txt | AC | 55 ms | 76720 KB |
| 01_handmade_02.txt | AC | 74 ms | 85932 KB |
| 01_handmade_03.txt | AC | 74 ms | 86192 KB |
| 01_handmade_04.txt | TLE | 2140 ms | 320400 KB |
| 01_handmade_05.txt | TLE | 2139 ms | 320524 KB |
| 02_random_00.txt | AC | 56 ms | 76332 KB |
| 02_random_01.txt | AC | 55 ms | 76672 KB |
| 02_random_02.txt | AC | 60 ms | 81660 KB |
| 02_random_03.txt | AC | 55 ms | 76516 KB |
| 02_random_04.txt | AC | 55 ms | 76776 KB |
| 02_random_05.txt | AC | 160 ms | 109896 KB |
| 02_random_06.txt | AC | 116 ms | 97164 KB |
| 02_random_07.txt | AC | 91 ms | 88064 KB |
| 02_random_08.txt | AC | 231 ms | 127100 KB |
| 02_random_09.txt | AC | 55 ms | 76444 KB |
| 02_random_10.txt | AC | 58 ms | 81408 KB |
| 02_random_11.txt | AC | 66 ms | 82048 KB |
| 02_random_12.txt | AC | 241 ms | 114116 KB |
| 02_random_13.txt | AC | 55 ms | 76740 KB |
| 02_random_14.txt | AC | 58 ms | 81536 KB |
| 02_random_15.txt | AC | 55 ms | 76440 KB |
| 02_random_16.txt | AC | 61 ms | 81400 KB |
| 02_random_17.txt | AC | 55 ms | 76328 KB |
| 02_random_18.txt | AC | 58 ms | 81472 KB |
| 02_random_19.txt | AC | 84 ms | 87012 KB |
| 02_random_20.txt | AC | 1129 ms | 267704 KB |
| 02_random_21.txt | AC | 56 ms | 76488 KB |
| 02_random_22.txt | AC | 59 ms | 81288 KB |
| 02_random_23.txt | AC | 56 ms | 76424 KB |
| 02_random_24.txt | AC | 69 ms | 82004 KB |
| 02_random_25.txt | AC | 96 ms | 90108 KB |
| 02_random_26.txt | TLE | 2225 ms | 329656 KB |
| 02_random_27.txt | AC | 103 ms | 90400 KB |
| 02_random_28.txt | TLE | 2183 ms | 320428 KB |
| 02_random_29.txt | AC | 85 ms | 86392 KB |
| 02_random_30.txt | TLE | 2221 ms | 330052 KB |
| 02_random_31.txt | AC | 96 ms | 89900 KB |
| 02_random_32.txt | TLE | 2226 ms | 329480 KB |