Submission #17396245


Source Code Expand

Copy
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;

using ll = long long;

ll x[50010], y[50010], z[50010], dp[110][110][110];

int main() {
	int n, m; cin >> n >> m;
	for (int i = 0; i < n; i++) {
		ll a, b, c, w; cin >> a >> b >> c >> w;
		dp[a][b][c] = max(dp[a][b][c], w);
	}
	for (int i = 0; i < m; i++)cin >> x[i] >> y[i] >> z[i];
	for (int i = 0; i < 105; i++)for (int j = 0; j < 105; j++)for (int k = 0; k < 105; k++) {
		dp[i + 1][j][k] = max(dp[i + 1][j][k], dp[i][j][k]);
		dp[i][j + 1][k] = max(dp[i][j + 1][k], dp[i][j][k]);
		dp[i][j][k + 1] = max(dp[i][j][k + 1], dp[i][j][k]);
	}
	for (int i = 0; i < m; i++) {
		cout << dp[x[i]][y[i]][z[i]] << endl;
	}

	return 0;
}

Submission Info

Submission Time
Task C - Optimal Recommendations
User nekosun
Language C++ (GCC 9.2.1)
Score 100
Code Size 735 Byte
Status
Exec Time 150 ms
Memory 14832 KB

Judge Result

Set Name All
Score / Max Score 100 / 100
Status
× 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 150 ms 14764 KB
10-random-01.txt 18 ms 13604 KB
10-random-02.txt 87 ms 14200 KB
10-random-03.txt 108 ms 14420 KB
10-random-04.txt 59 ms 13720 KB
20-absW-00.txt 136 ms 14748 KB
20-absW-01.txt 18 ms 13608 KB
20-absW-02.txt 76 ms 13976 KB
20-absW-03.txt 117 ms 14668 KB
20-absW-04.txt 58 ms 13816 KB
30-balance-00.txt 144 ms 14592 KB
30-balance-01.txt 19 ms 13600 KB
30-balance-02.txt 53 ms 13868 KB
30-balance-03.txt 85 ms 14044 KB
30-balance-04.txt 106 ms 14644 KB
40-limit_dim-00.txt 145 ms 14572 KB
40-limit_dim-01.txt 143 ms 14748 KB
40-limit_dim-02.txt 142 ms 14724 KB
40-limit_dim-03.txt 147 ms 14764 KB
40-limit_dim-04.txt 141 ms 14796 KB
40-limit_dim-05.txt 143 ms 14572 KB
40-limit_dim-06.txt 142 ms 14832 KB
Corner1.txt 16 ms 13460 KB
Sample1.txt 17 ms 13668 KB