Submission #19247708


Source Code Expand

Copy
#include <iostream>
#include <vector>

int N = 0, M = 0;
int dp[110][110][110] = {};

int main() {
	std::cin >> N >> M;

	for (int i = 0; i < N; i++)
	{
		int a, b, c, w;
		std::cin >> a >> b >> c >> w;
		dp[a][b][c] = std::max(dp[a][b][c], w);
	}

	for (int i = 0; i <= 100; i++)
		for (int j = 0; j <= 100; j++)
			for (int k = 0; k <= 100; k++)
			{
				dp[i + 1][j][k] = std::max(dp[i][j][k], dp[i + 1][j][k]);
				dp[i][j + 1][k] = std::max(dp[i][j][k], dp[i][j + 1][k]);
				dp[i][j][k + 1] = std::max(dp[i][j][k], dp[i][j][k + 1]);
			}

	for (int i = 0; i < M; i++)
	{
		int x, y, z;
		std::cin >> x >> y >> z;
		std::cout << dp[x][y][z] << std::endl;
	}

	return 0;
}

Submission Info

Submission Time
Task C - Optimal Recommendations
User h0geh0ge
Language C++ (GCC 9.2.1)
Score 100
Code Size 709 Byte
Status AC
Exec Time 144 ms
Memory 8396 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 141 ms 8388 KB
10-random-01.txt AC 11 ms 8244 KB
10-random-02.txt AC 81 ms 8392 KB
10-random-03.txt AC 103 ms 8348 KB
10-random-04.txt AC 55 ms 8232 KB
20-absW-00.txt AC 132 ms 8388 KB
20-absW-01.txt AC 14 ms 8392 KB
20-absW-02.txt AC 73 ms 8388 KB
20-absW-03.txt AC 109 ms 8344 KB
20-absW-04.txt AC 54 ms 8204 KB
30-balance-00.txt AC 138 ms 8348 KB
30-balance-01.txt AC 19 ms 8388 KB
30-balance-02.txt AC 54 ms 8364 KB
30-balance-03.txt AC 81 ms 8368 KB
30-balance-04.txt AC 100 ms 8316 KB
40-limit_dim-00.txt AC 143 ms 8232 KB
40-limit_dim-01.txt AC 140 ms 8324 KB
40-limit_dim-02.txt AC 137 ms 8344 KB
40-limit_dim-03.txt AC 138 ms 8364 KB
40-limit_dim-04.txt AC 144 ms 8396 KB
40-limit_dim-05.txt AC 139 ms 8324 KB
40-limit_dim-06.txt AC 139 ms 8208 KB
Corner1.txt AC 13 ms 8228 KB
Sample1.txt AC 14 ms 8208 KB