Submission #16514322


Source Code Expand

Copy
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <bitset>
#include <queue>
typedef long long ll;
#define rep(i,n) for(int i = 0;i<n;++i)
#define repc(bit,k,n) for (int bit = (1<<k)-1;bit < (1<<n); bit = next_combination(bit))
#define repi(itr,vec) for(auto itr = vec.begin();itr!=vec.end();++itr)
using namespace std;
using Graph = vector<vector<int> >;

/* next combination
 * usage:repc(bit,k,n)
 * */
inline int next_combination(int sub) {
  int x = sub & -sub, y = sub + x;
  return (((sub & ~y) / x) >> 1) | y;
}

/* uniq
 * usage:uniq(vec)
 * */
void uniq(vector<int> &vec){
  sort(vec.begin(), vec.end());
  vec.erase(unique(vec.begin(), vec.end()), vec.end());
  return;
}

/* BinaryIndexedTree
 * usage:update and sum of 1~N
 * */
int N;
int bit[1000010];
void add(int a, int w) {
  for (int x = a; x <= N; x += x & -x) bit[x] += w;
}
int sum(int a) {
  int ret = 0;
  for (int x = a; x > 0; x -= x & -x) ret += bit[x];
  return ret;
}

/* DP
 * usage: chmin(dp[i],dp[i-1]+v);
 * */
const ll INF = 1LL << 60;
int dp[101][101][101];

template<class T> inline bool chmin(T& a, T b) {
      if (a > b) {
                a = b;
                        return true;
                            }
          return false;
}
template<class T> inline bool chmax(T& a, T b) {
      if (a < b) {
                a = b;
                        return true;
                            }
          return false;
}

int count16bit(unsigned short v) {
  unsigned short count = (v & 0x5555) + ((v >> 1) & 0x5555);
  count = (count & 0x3333) + ((count >> 2) & 0x3333);
  count = (count & 0x0f0f) + ((count >> 4) & 0x0f0f);
  return (count & 0x00ff) + ((count >> 8) & 0x00ff);
}
ll solve(ll a,ll b, ll c, const vector<vector<ll> > &company){
  repi(itr,company){
    if(((*itr)[1]<=a)&&((*itr)[2]<=b)&&((*itr)[3]<=c))return (*itr)[0];
  }
  return 0;
}
int main(){
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int n,m;cin>>n>>m;
  rep(i,n){
    int a,b,c,w;cin>>a>>b>>c>>w;
    dp[a][b][c] = w;
  }
  rep(i,101){
    rep(j,101){
      rep(k,101){
        chmax(dp[i][j][k],dp[(i-1)>=0?i-1:0][j][k]);
        chmax(dp[i][j][k],dp[i][(j-1)>=0?j-1:0][k]);
        chmax(dp[i][j][k],dp[i][j][(k-1)>=0?k-1:0]);
      }
    }

  }
  rep(i,m){
    int a,b,c;cin>>a>>b>>c;
    cout<<dp[a][b][c]<<endl;
  }


  return 0;
}

Submission Info

Submission Time
Task C - Optimal Recommendations
User koppepyan
Language C++ (GCC 9.2.1)
Score 0
Code Size 2450 Byte
Status WA
Exec Time 112 ms
Memory 7676 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 112 ms 7652 KB
10-random-01.txt AC 11 ms 4220 KB
10-random-02.txt AC 71 ms 7676 KB
10-random-03.txt WA 88 ms 7552 KB
10-random-04.txt WA 35 ms 7560 KB
20-absW-00.txt AC 108 ms 7524 KB
20-absW-01.txt AC 10 ms 4864 KB
20-absW-02.txt AC 53 ms 7504 KB
20-absW-03.txt AC 97 ms 7676 KB
20-absW-04.txt AC 40 ms 7556 KB
30-balance-00.txt WA 108 ms 7672 KB
30-balance-01.txt AC 12 ms 7628 KB
30-balance-02.txt AC 47 ms 7604 KB
30-balance-03.txt WA 53 ms 7576 KB
30-balance-04.txt WA 95 ms 7556 KB
40-limit_dim-00.txt WA 107 ms 3600 KB
40-limit_dim-01.txt WA 108 ms 3952 KB
40-limit_dim-02.txt WA 107 ms 3656 KB
40-limit_dim-03.txt WA 109 ms 7572 KB
40-limit_dim-04.txt WA 108 ms 3540 KB
40-limit_dim-05.txt WA 104 ms 3992 KB
40-limit_dim-06.txt WA 103 ms 3540 KB
Corner1.txt WA 12 ms 7468 KB
Sample1.txt AC 11 ms 7604 KB