Submission #17399455


Source Code Expand

Copy
#include<bits/stdc++.h>
using namespace std;
int main () {
  int N, M;
  cin >> N >> M;
  long long 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;
      }
    }
  }
  sal[0][0][0] = 0;
  for (int i = 0; i < N; i ++) {
    int a, b, c;
    long long w;
    cin >> a >> b >> c >> w;
    sal[a][b][c] = w;
  }
  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]);
        //if (sal[i][j][k] == -1) cout << 'N' << endl;
      }
    }
  }
  for (int i = 0; i < M; 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 963 Byte
Status
Exec Time 145 ms
Memory 11676 KB

Judge Result

Set Name All
Score / Max Score 0 / 100
Status
× 10
× 14
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 145 ms 11652 KB
10-random-01.txt 14 ms 11652 KB
10-random-02.txt 83 ms 11648 KB
10-random-03.txt 103 ms 11460 KB
10-random-04.txt 55 ms 11676 KB
20-absW-00.txt 134 ms 11572 KB
20-absW-01.txt 15 ms 11620 KB
20-absW-02.txt 74 ms 11628 KB
20-absW-03.txt 111 ms 11484 KB
20-absW-04.txt 54 ms 11456 KB
30-balance-00.txt 139 ms 11576 KB
30-balance-01.txt 16 ms 11620 KB
30-balance-02.txt 54 ms 11604 KB
30-balance-03.txt 83 ms 11500 KB
30-balance-04.txt 99 ms 11500 KB
40-limit_dim-00.txt 144 ms 11624 KB
40-limit_dim-01.txt 140 ms 11500 KB
40-limit_dim-02.txt 141 ms 11648 KB
40-limit_dim-03.txt 140 ms 11460 KB
40-limit_dim-04.txt 139 ms 11624 KB
40-limit_dim-05.txt 136 ms 11624 KB
40-limit_dim-06.txt 139 ms 11624 KB
Corner1.txt 13 ms 11656 KB
Sample1.txt 16 ms 11488 KB