Submission #65029776
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={}def solve(state,val):if (state,val) in dp:return dp[(state,val)]res=0for i in range(n):if (state>>i)&1:res+=scp[i][0]for i in range(n):if (state>>i)&1:continueif val-scp[i][1]<0:continue
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={}
def solve(state,val):
if (state,val) in dp:return dp[(state,val)]
res=0
for i in range(n):
if (state>>i)&1:
res+=scp[i][0]
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 | 683 Byte |
| Status | TLE |
| Exec Time | 2224 ms |
| Memory | 331840 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 | 56 ms | 76680 KB |
| 00_sample_01.txt | AC | 58 ms | 76548 KB |
| 00_sample_02.txt | AC | 66 ms | 81564 KB |
| 00_sample_03.txt | AC | 86 ms | 83788 KB |
| 01_handmade_00.txt | AC | 57 ms | 76596 KB |
| 01_handmade_01.txt | AC | 57 ms | 76436 KB |
| 01_handmade_02.txt | AC | 95 ms | 90464 KB |
| 01_handmade_03.txt | AC | 94 ms | 90448 KB |
| 01_handmade_04.txt | TLE | 2224 ms | 320656 KB |
| 01_handmade_05.txt | TLE | 2223 ms | 321032 KB |
| 02_random_00.txt | AC | 56 ms | 76396 KB |
| 02_random_01.txt | AC | 59 ms | 76584 KB |
| 02_random_02.txt | AC | 61 ms | 80832 KB |
| 02_random_03.txt | AC | 57 ms | 76472 KB |
| 02_random_04.txt | AC | 57 ms | 76816 KB |
| 02_random_05.txt | AC | 176 ms | 110572 KB |
| 02_random_06.txt | AC | 123 ms | 97144 KB |
| 02_random_07.txt | AC | 109 ms | 88144 KB |
| 02_random_08.txt | AC | 238 ms | 124996 KB |
| 02_random_09.txt | AC | 57 ms | 76780 KB |
| 02_random_10.txt | AC | 58 ms | 76592 KB |
| 02_random_11.txt | AC | 72 ms | 82540 KB |
| 02_random_12.txt | AC | 251 ms | 114500 KB |
| 02_random_13.txt | AC | 57 ms | 76440 KB |
| 02_random_14.txt | AC | 57 ms | 76588 KB |
| 02_random_15.txt | AC | 57 ms | 76728 KB |
| 02_random_16.txt | AC | 57 ms | 76464 KB |
| 02_random_17.txt | AC | 58 ms | 76564 KB |
| 02_random_18.txt | AC | 58 ms | 76488 KB |
| 02_random_19.txt | AC | 101 ms | 86900 KB |
| 02_random_20.txt | AC | 1192 ms | 268136 KB |
| 02_random_21.txt | AC | 56 ms | 76712 KB |
| 02_random_22.txt | AC | 57 ms | 76600 KB |
| 02_random_23.txt | AC | 57 ms | 76368 KB |
| 02_random_24.txt | AC | 68 ms | 82112 KB |
| 02_random_25.txt | AC | 116 ms | 88324 KB |
| 02_random_26.txt | TLE | 2221 ms | 328728 KB |
| 02_random_27.txt | AC | 132 ms | 94556 KB |
| 02_random_28.txt | TLE | 2224 ms | 320388 KB |
| 02_random_29.txt | AC | 100 ms | 86928 KB |
| 02_random_30.txt | TLE | 2222 ms | 331840 KB |
| 02_random_31.txt | AC | 115 ms | 88160 KB |
| 02_random_32.txt | TLE | 2221 ms | 328772 KB |