Submission #17399404


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;
      }
    }
  }
  sal[0][0][0] = 0;
  for (int i = 0; i < N; i ++) {
    int a, b, c, 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 942 Byte
Status
Exec Time 141 ms
Memory 7612 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 141 ms 7516 KB
10-random-01.txt 20 ms 7552 KB
10-random-02.txt 79 ms 7516 KB
10-random-03.txt 102 ms 7516 KB
10-random-04.txt 55 ms 7392 KB
20-absW-00.txt 129 ms 7448 KB
20-absW-01.txt 11 ms 7588 KB
20-absW-02.txt 74 ms 7604 KB
20-absW-03.txt 113 ms 7516 KB
20-absW-04.txt 50 ms 7612 KB
30-balance-00.txt 139 ms 7600 KB
30-balance-01.txt 12 ms 7516 KB
30-balance-02.txt 52 ms 7588 KB
30-balance-03.txt 80 ms 7404 KB
30-balance-04.txt 101 ms 7592 KB
40-limit_dim-00.txt 140 ms 7588 KB
40-limit_dim-01.txt 139 ms 7588 KB
40-limit_dim-02.txt 141 ms 7600 KB
40-limit_dim-03.txt 139 ms 7452 KB
40-limit_dim-04.txt 140 ms 7516 KB
40-limit_dim-05.txt 138 ms 7576 KB
40-limit_dim-06.txt 139 ms 7448 KB
Corner1.txt 11 ms 7600 KB
Sample1.txt 10 ms 7592 KB