Submission #16506371


Source Code Expand

Copy
n, m = map(int, input().split())
jobs = [list(map(int, input().split())) for _ in range(n)]
seekers = [list(map(int, input().split())) for _ in range(m)]

dp = [[[0 for _ in range(102)] for i in range(102)] for j in range(102)]

for a, b, c, w in jobs:
    dp[a][b][c] = max(w, dp[a][b][c])

for i in range(101):
    for j in range(101):
        for k in range(101):
            dp[i+1][j][k] = max(dp[i][j][k], dp[i+1][j][k])
            dp[i][j+1][k] = max(dp[i][j][k], dp[i][j+1][k])
            dp[i][j][k+1] = max(dp[i][j][k], dp[i][j][k+1])

for a, b, c in seekers:
    print(dp[a][b][c])

Submission Info

Submission Time
Task C - Optimal Recommendations
User keroido
Language Python (3.8.2)
Score 100
Code Size 611 Byte
Status AC
Exec Time 1653 ms
Memory 32508 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 1586 ms 32488 KB
10-random-01.txt AC 1372 ms 18020 KB
10-random-02.txt AC 1436 ms 22820 KB
10-random-03.txt AC 1469 ms 26204 KB
10-random-04.txt AC 1460 ms 25248 KB
20-absW-00.txt AC 1581 ms 31112 KB
20-absW-01.txt AC 1328 ms 18080 KB
20-absW-02.txt AC 1544 ms 26568 KB
20-absW-03.txt AC 1507 ms 27012 KB
20-absW-04.txt AC 1437 ms 21600 KB
30-balance-00.txt AC 1621 ms 32508 KB
30-balance-01.txt AC 1391 ms 18052 KB
30-balance-02.txt AC 1397 ms 20752 KB
30-balance-03.txt AC 1546 ms 28360 KB
30-balance-04.txt AC 1561 ms 24464 KB
40-limit_dim-00.txt AC 1600 ms 32404 KB
40-limit_dim-01.txt AC 1634 ms 32472 KB
40-limit_dim-02.txt AC 1573 ms 32392 KB
40-limit_dim-03.txt AC 1653 ms 32488 KB
40-limit_dim-04.txt AC 1574 ms 32448 KB
40-limit_dim-05.txt AC 1579 ms 32420 KB
40-limit_dim-06.txt AC 1551 ms 32492 KB
Corner1.txt AC 1316 ms 18000 KB
Sample1.txt AC 1345 ms 17940 KB