Submission #19081052


Source Code Expand

Copy
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep(i, from, to) for (ll i = from; i < (to); ++i)
#define mp(x,y) make_pair(x,y)
#define all(x) (x).begin(),(x).end()
#define sz(x) (int)(x).size()
#define pb push_back
using ll = long long;
using ld=long double;
using vin=vector<int>;
using vvin=vector<vin>;
using vll=vector<ll>;
using vvll=vector<vll>;
using vst=vector<string>;
using P = pair<ll,ll>;
using vp=vector<P>;
using vvp=vector<vp>;
const int inf=1e9+7;
const ll INF=9e18/2;
const long double PI = acos(-1.0); 
template <typename T> bool chmin(T &a, const T& b){if(a > b){a = b;return true;}return false;}
template <typename T> bool chmax(T &a, const T& b){if(a < b){a = b;return true;}return false;}
template<class T> inline void Yes(T condition){ if(condition) cout << "Yes" << endl; else cout << "No" << endl; }
template<class T> inline void YES(T condition){ if(condition) cout << "YES" << endl; else cout << "NO" << endl; }
const int dx[4] = { 1, 0, -1, 0 };
const int dy[4] = { 0, 1, 0, -1 };

ll dp[110][110][110];

int main(){//cout<<fixed<<setprecision(20);
  int n,m;
  cin>>n>>m;
  rep(i,0,n){
    ll a,b,c,w;
    cin>>a>>b>>c>>w;
    chmax(dp[a][b][c],w);
  }
  
  rep(i,0,110){
   rep(j,0,110){
    rep(k,0,110){
      if(i-1>=0)chmax(dp[i][j][k],dp[i-1][j][k]);
      if(j-1>=0)chmax(dp[i][j][k],dp[i][j-1][k]);
      if(k-1>=0)chmax(dp[i][j][k],dp[i][j][k-1]);
    }
   }
  }
  
  
  rep(i,0,m){
    ll x,y,z;
    cin>>x>>y>>z;
    cout<<dp[x][y][z]<<endl;
  }
}

Submission Info

Submission Time
Task C - Optimal Recommendations
User takekinmkk
Language C++ (GCC 9.2.1)
Score 100
Code Size 1573 Byte
Status AC
Exec Time 147 ms
Memory 14004 KB

Judge Result

Set Name All
Score / Max Score 100 / 100
Status
AC × 24
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 AC 147 ms 13944 KB
10-random-01.txt AC 13 ms 5248 KB
10-random-02.txt AC 82 ms 13932 KB
10-random-03.txt AC 106 ms 13924 KB
10-random-04.txt AC 59 ms 13920 KB
20-absW-00.txt AC 138 ms 13948 KB
20-absW-01.txt AC 15 ms 6740 KB
20-absW-02.txt AC 79 ms 13948 KB
20-absW-03.txt AC 116 ms 13940 KB
20-absW-04.txt AC 56 ms 13908 KB
30-balance-00.txt AC 141 ms 14004 KB
30-balance-01.txt AC 23 ms 13940 KB
30-balance-02.txt AC 57 ms 13812 KB
30-balance-03.txt AC 86 ms 13808 KB
30-balance-04.txt AC 102 ms 13924 KB
40-limit_dim-00.txt AC 140 ms 3672 KB
40-limit_dim-01.txt AC 139 ms 4676 KB
40-limit_dim-02.txt AC 139 ms 4356 KB
40-limit_dim-03.txt AC 144 ms 13788 KB
40-limit_dim-04.txt AC 137 ms 3480 KB
40-limit_dim-05.txt AC 139 ms 4792 KB
40-limit_dim-06.txt AC 139 ms 4552 KB
Corner1.txt AC 23 ms 13652 KB
Sample1.txt AC 17 ms 13856 KB