Submission #17399363


Source Code Expand

Copy
#include<bits/stdc++.h>
using namespace std;
int main () {
  int N, M;
  cin >> N >> M;
  int sal[101][101][101];
  for (int i = 0; i < 101; i ++) {
    for (int j = 0; j < 101; j ++) {
      for (int k = 0; k < 101; k ++) {
        sal[i][j][k] = -1;
      }
    }
  }
  for (int i = 0; i < N; i ++) {
    int a, b, c, w;
    cin >> a >> b >> c >> w;
    sal[a][b][c] = w;
  }
  sal[0][0][0] = 0;
  for (int i = 0; i < 101; i ++) {
    for (int j = 0; j < 101; j ++) {
      for (int k = 0; k < 101; k ++) {
        if (i > 0) sal[i][j][k] = max(sal[i][j][k], sal[i - 1][j][k]);
        if (j > 0) sal[i][j][k] = max(sal[i][j][k], sal[i][j - 1][k]);
        if (k > 0) sal[i][j][k] = max(sal[i][j][k], sal[i][j][k - 1]);
      }
    }
  }
  for (int i = 0; i < N; i ++) {
    int x, y, z;
    cin >> x >> y >> z;
    cout << sal[x][y][z] << endl;
  }
}

Submission Info

Submission Time
Task C - Optimal Recommendations
User kumjin3141
Language C++ (GCC 9.2.1)
Score 0
Code Size 886 Byte
Status
Exec Time 142 ms
Memory 7660 KB

Judge Result

Set Name All
Score / Max Score 0 / 100
Status
× 3
× 21
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 142 ms 7476 KB
10-random-01.txt 12 ms 7648 KB
10-random-02.txt 23 ms 7548 KB
10-random-03.txt 63 ms 7608 KB
10-random-04.txt 95 ms 7660 KB
20-absW-00.txt 133 ms 7548 KB
20-absW-01.txt 12 ms 7476 KB
20-absW-02.txt 112 ms 7456 KB
20-absW-03.txt 74 ms 7660 KB
20-absW-04.txt 46 ms 7476 KB
30-balance-00.txt 142 ms 7620 KB
30-balance-01.txt 13 ms 7456 KB
30-balance-02.txt 25 ms 7432 KB
30-balance-03.txt 127 ms 7456 KB
30-balance-04.txt 33 ms 7476 KB
40-limit_dim-00.txt 142 ms 7624 KB
40-limit_dim-01.txt 141 ms 7548 KB
40-limit_dim-02.txt 140 ms 7544 KB
40-limit_dim-03.txt 139 ms 7660 KB
40-limit_dim-04.txt 142 ms 7648 KB
40-limit_dim-05.txt 139 ms 7548 KB
40-limit_dim-06.txt 142 ms 7548 KB
Corner1.txt 12 ms 7576 KB
Sample1.txt 13 ms 7432 KB