Submission #19081024


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,1,110){
   rep(j,1,110){
    rep(k,1,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 0
Code Size 1573 Byte
Status WA
Exec Time 149 ms
Memory 13972 KB

Judge Result

Set Name All
Score / Max Score 0 / 100
Status
AC × 9
WA × 15
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 149 ms 13904 KB
10-random-01.txt AC 14 ms 5236 KB
10-random-02.txt WA 89 ms 13888 KB
10-random-03.txt WA 109 ms 13760 KB
10-random-04.txt WA 63 ms 13972 KB
20-absW-00.txt WA 139 ms 13956 KB
20-absW-01.txt AC 16 ms 6812 KB
20-absW-02.txt WA 83 ms 13912 KB
20-absW-03.txt WA 120 ms 13884 KB
20-absW-04.txt WA 60 ms 13912 KB
30-balance-00.txt WA 147 ms 13928 KB
30-balance-01.txt AC 13 ms 3488 KB
30-balance-02.txt WA 58 ms 13892 KB
30-balance-03.txt WA 91 ms 13788 KB
30-balance-04.txt WA 105 ms 13852 KB
40-limit_dim-00.txt AC 142 ms 3644 KB
40-limit_dim-01.txt AC 141 ms 4808 KB
40-limit_dim-02.txt AC 140 ms 4356 KB
40-limit_dim-03.txt WA 148 ms 13792 KB
40-limit_dim-04.txt AC 137 ms 3528 KB
40-limit_dim-05.txt WA 140 ms 4876 KB
40-limit_dim-06.txt WA 138 ms 4436 KB
Corner1.txt AC 19 ms 13852 KB
Sample1.txt AC 21 ms 13820 KB