Submission #17399361


Source Code Expand

Copy
#include<bits/stdc++.h>
using namespace std;
int main () {
  int N, M;
  vin >> 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

Compile Error

./Main.cpp: In function ‘int main()’:
./Main.cpp:5:3: error: ‘vin’ was not declared in this scope; did you mean ‘sin’?
    5 |   vin >> N >> M;
      |   ^~~
      |   sin