Submission #8403758


Source Code Expand

#include <iostream>
#include <algorithm>
using namespace std;

#define REP(i,n)    for(int i = 0; i < (int)n; i++)
#define N_MAX   50000
#define M_MAX   50000
typedef long long    ll;

ll dp[M_MAX][N_MAX + 1];

int N, M;
int a[N_MAX], b[N_MAX], c[N_MAX];
ll w[N_MAX];
int x[M_MAX], y[M_MAX], z[M_MAX];

bool workable(int i, int j){
    if(a[j] <= x[i] && b[j] <= y[i] && c[j] <= z[i])
        return true;
    else
        return false;
}

void solve (){
    REP(i,M){
        REP(j,N){
            if(workable(i, j))
                dp[i][j + 1] = max(dp[i][j], w[j]);
            else
                dp[i][j + 1] = dp[i][j];
        }
    }
    REP(i,M)
        cout << dp[i][N] << endl;
}

int main (){
    cin >> N >> M;
    REP(i,N)
        cin >> a[i] >> b[i] >> c[i] >> w[i];
    REP(i,M)
        cin >> x[i] >> y[i] >> z[i];
    
    solve();
    
    return 0;
}

Submission Info

Submission Time
Task C - Optimal Recommendations
User molinuntius
Language C++14 (GCC 5.4.1)
Score 0
Code Size 920 Byte
Status CE

Compile Error

/tmp/ccQL2PCY.o: In function `_GLOBAL__sub_I_dp':
Main.cpp:(.text.startup+0x115): relocation truncated to fit: R_X86_64_32 against `.bss'
Main.cpp:(.text.startup+0x124): relocation truncated to fit: R_X86_64_32 against `.bss'
collect2: error: ld returned 1 exit status