Submission #19058076


Source Code Expand

Copy
#include <bits/stdc++.h>
#define rep(i,n) for (int i=0; i<n; i++)
#define rng(i,l,r) for (int i=l; i<r; i++)
#define all(x) begin(x), end(x)
using namespace std;
using ll = long long;
using P = pair<int,int>;
template <class T> using V = vector<T>;
template<class T> bool chmin(T& a, T b){ if (a > b){ a = b; return true; } return false; }
template<class T> bool chmax(T& a, T b){ if (a < b){ a = b; return true; } return false; }
struct in { template <class T> operator T() { T t; std::cin >> t; return t; } };
const int INF = 1 << 30;
const ll LINF = 1LL << 60;
int dx[8] = {0,1,0,-1,1,1,-1,-1};
int dy[8] = {1,0,-1,0,1,-1,1,-1};

auto solve() {
   int n = in();
   int m = in();
   // vector<int> a(n),b(n),c(n),w(n),x(m),y(m),z(m);
   // rep(i,n) cin >> a[i] >> b[i] >> c[i] >> w[i];
   // rep(i,m) cin >> x[i] >> y[i] >> z[i];

   int lim = 100;
   V<V<V<int>>> s(lim+1, V<V<int>>(lim+1, V<int>(lim+1, 0)));
   rep(i,n) {
      int a = in(), b = in(), c = in(), w = in();
      s[a][b][c] = w;
   }

   rep(i,lim+1) rep(j,lim+1) rep(k,lim+1) {
      if (i > 0) chmax(s[i][j][k], s[i-1][j][k]);
      if (j > 0) chmax(s[i][j][k], s[i][j-1][k]);
      if (k > 0) chmax(s[i][j][k], s[i][j][k-1]);
   }
   rep(i,m) {
      int x = in(), y = in(), z = in();
      cout << s[x][y][z] << endl;
   }
}

int main() {
   ios::sync_with_stdio(false);
   cin.tie(0);

   solve();
}

Submission Info

Submission Time
Task C - Optimal Recommendations
User mitsunoir
Language C++ (GCC 9.2.1)
Score 0
Code Size 1375 Byte
Status WA
Exec Time 109 ms
Memory 7664 KB

Judge Result

Set Name All
Score / Max Score 0 / 100
Status
AC × 10
WA × 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 WA 108 ms 7432 KB
10-random-01.txt AC 19 ms 7656 KB
10-random-02.txt AC 69 ms 7592 KB
10-random-03.txt WA 88 ms 7472 KB
10-random-04.txt WA 33 ms 7612 KB
20-absW-00.txt AC 109 ms 7588 KB
20-absW-01.txt AC 13 ms 7480 KB
20-absW-02.txt AC 58 ms 7536 KB
20-absW-03.txt AC 90 ms 7588 KB
20-absW-04.txt AC 47 ms 7604 KB
30-balance-00.txt WA 105 ms 7656 KB
30-balance-01.txt AC 18 ms 7584 KB
30-balance-02.txt AC 46 ms 7660 KB
30-balance-03.txt WA 59 ms 7612 KB
30-balance-04.txt WA 88 ms 7608 KB
40-limit_dim-00.txt WA 103 ms 7552 KB
40-limit_dim-01.txt WA 103 ms 7556 KB
40-limit_dim-02.txt WA 106 ms 7536 KB
40-limit_dim-03.txt WA 105 ms 7656 KB
40-limit_dim-04.txt WA 103 ms 7480 KB
40-limit_dim-05.txt WA 103 ms 7588 KB
40-limit_dim-06.txt WA 101 ms 7664 KB
Corner1.txt WA 12 ms 7608 KB
Sample1.txt AC 10 ms 7476 KB