Submission #17514320


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])

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 1371 Byte
Status
Exec Time 904 ms
Memory 20316 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 904 ms 20296 KB
10-random-01.txt 721 ms 18392 KB
10-random-02.txt 809 ms 18820 KB
10-random-03.txt 795 ms 19184 KB
10-random-04.txt 770 ms 19956 KB
20-absW-00.txt 878 ms 18712 KB
20-absW-01.txt 752 ms 18564 KB
20-absW-02.txt 814 ms 18668 KB
20-absW-03.txt 857 ms 18896 KB
20-absW-04.txt 771 ms 18736 KB
30-balance-00.txt 848 ms 20316 KB
30-balance-01.txt 726 ms 18620 KB
30-balance-02.txt 746 ms 18780 KB
30-balance-03.txt 798 ms 20056 KB
30-balance-04.txt 783 ms 18856 KB
40-limit_dim-00.txt 855 ms 18748 KB
40-limit_dim-01.txt 834 ms 18724 KB
40-limit_dim-02.txt 846 ms 18800 KB
40-limit_dim-03.txt 851 ms 18884 KB
40-limit_dim-04.txt 837 ms 18740 KB
40-limit_dim-05.txt 862 ms 19024 KB
40-limit_dim-06.txt 833 ms 18896 KB
Corner1.txt 772 ms 18580 KB
Sample1.txt 738 ms 18388 KB