Submission #16520635


Source Code Expand

Copy
N, M = map(int,input().split())

dp = [[[0 for i in range(101)] for j in range(101)] for k in range(101)]

for _ in range(N):
    a, b, c, w = map(int,input().split())
    dp[a][b][c] = max(w, dp[a][b][c])

for a in range(101):
    for b in range(101):
        for c in range(101):
            if a > 0:
                dp[a][b][c] = max(dp[a][b][c], dp[a-1][b][c])
            if b > 0:
                dp[a][b][c] = max(dp[a][b][c], dp[a][b-1][c])
            if c > 0:
                dp[a][b][c] = max(dp[a][b][c], dp[a][b][c-1])

for _ in range(M):
    x, y, z = map(int,input().split())
    print(dp[x][y][z])

Submission Info

Submission Time
Task C - Optimal Recommendations
User kuruton456
Language Python (3.8.2)
Score 100
Code Size 635 Byte
Status AC
Exec Time 1734 ms
Memory 19628 KB

Judge Result

Set Name All
Score / Max Score 100 / 100
Status
AC × 24
Set Name Test Cases
All 10-random-00.txt, 10-random-01.txt, 10-random-02.txt, 10-random-03.txt, 10-random-04.txt, 20-absW-00.txt, 20-absW-01.txt, 20-absW-02.txt, 20-absW-03.txt, 20-absW-04.txt, 30-balance-00.txt, 30-balance-01.txt, 30-balance-02.txt, 30-balance-03.txt, 30-balance-04.txt, 40-limit_dim-00.txt, 40-limit_dim-01.txt, 40-limit_dim-02.txt, 40-limit_dim-03.txt, 40-limit_dim-04.txt, 40-limit_dim-05.txt, 40-limit_dim-06.txt, Corner1.txt, Sample1.txt
Case Name Status Exec Time Memory
10-random-00.txt AC 1643 ms 19460 KB
10-random-01.txt AC 1366 ms 17748 KB
10-random-02.txt AC 1601 ms 18044 KB
10-random-03.txt AC 1626 ms 18576 KB
10-random-04.txt AC 1416 ms 19220 KB
20-absW-00.txt AC 1734 ms 17772 KB
20-absW-01.txt AC 1425 ms 17780 KB
20-absW-02.txt AC 1485 ms 17900 KB
20-absW-03.txt AC 1590 ms 17876 KB
20-absW-04.txt AC 1429 ms 17768 KB
30-balance-00.txt AC 1643 ms 19504 KB
30-balance-01.txt AC 1305 ms 17896 KB
30-balance-02.txt AC 1370 ms 18140 KB
30-balance-03.txt AC 1497 ms 19628 KB
30-balance-04.txt AC 1541 ms 18040 KB
40-limit_dim-00.txt AC 1724 ms 18012 KB
40-limit_dim-01.txt AC 1672 ms 17936 KB
40-limit_dim-02.txt AC 1648 ms 17872 KB
40-limit_dim-03.txt AC 1727 ms 18412 KB
40-limit_dim-04.txt AC 1634 ms 17772 KB
40-limit_dim-05.txt AC 1646 ms 18312 KB
40-limit_dim-06.txt AC 1675 ms 18576 KB
Corner1.txt AC 1380 ms 17776 KB
Sample1.txt AC 1321 ms 17892 KB