Submission #17514452


Source Code Expand

Copy
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees, log2, gcd
from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left, insort, insort_left
from heapq import heappush, heappop, heapify
from functools import reduce, lru_cache
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def TUPLE(): return tuple(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7 
#mod = 998244353
#from decimal import *
#import numpy as np
#decimal.getcontext().prec = 10

N, M = MAP()
n = 101
dp = [[[0]*n for _ in range(n)] for _ in range(n)]

for _ in range(N):
	a, b, c, w = MAP()
	dp[a][b][c] = w

for x in range(1, n):
	for y in range(1, n):
		for z in range(1, n):
			dp[x][y][z] = max(dp[x][y][z], dp[x-1][y][z], dp[x][y-1][z], dp[x][y][z-1], dp[x][y-1][z-1], dp[x-1][y-1][z], dp[x-1][y][z-1], dp[x-1][y-1][z-1])

for _ in range(M):
	x, y, z = MAP()
	print(dp[x][y][z])

Submission Info

Submission Time
Task C - Optimal Recommendations
User Koreggo
Language Python (3.8.2)
Score 0
Code Size 1441 Byte
Status
Exec Time 1609 ms
Memory 20368 KB

Judge Result

Set Name All
Score / Max Score 0 / 100
Status
× 4
× 20
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 1557 ms 20200 KB
10-random-01.txt 1382 ms 18680 KB
10-random-02.txt 1378 ms 18836 KB
10-random-03.txt 1446 ms 19464 KB
10-random-04.txt 1440 ms 19812 KB
20-absW-00.txt 1535 ms 18784 KB
20-absW-01.txt 1366 ms 18456 KB
20-absW-02.txt 1412 ms 18728 KB
20-absW-03.txt 1445 ms 18784 KB
20-absW-04.txt 1456 ms 18716 KB
30-balance-00.txt 1609 ms 20368 KB
30-balance-01.txt 1291 ms 18496 KB
30-balance-02.txt 1339 ms 18728 KB
30-balance-03.txt 1404 ms 20336 KB
30-balance-04.txt 1403 ms 18648 KB
40-limit_dim-00.txt 1457 ms 18836 KB
40-limit_dim-01.txt 1456 ms 18960 KB
40-limit_dim-02.txt 1484 ms 18504 KB
40-limit_dim-03.txt 1537 ms 19216 KB
40-limit_dim-04.txt 1457 ms 18672 KB
40-limit_dim-05.txt 1454 ms 19156 KB
40-limit_dim-06.txt 1467 ms 19160 KB
Corner1.txt 1293 ms 18676 KB
Sample1.txt 1331 ms 18680 KB