Submission #675044

# Submission time Handle Problem Language Result Execution time Memory
675044 2022-12-26T20:36:31 Z Hacv16 Horses (IOI15_horses) C++17
Compilation error
0 ms 0 KB
#include <bits/stdc++.h>
using namespace std;

#define fr first
#define sc second

typedef long long ll;
const int MAX = 1010;
const int INF = 0x3f3f3f3f;
const int MOD = 1e9 + 7;

int n, memo[15][MAX], x[15], y[15];

int dp(int i, int j){
    if(memo[i][j] != -1) return memo[i][j];
    if(i == n + 1) return 0;

    int ans = -INF;

    for(int sell = 0; sell <= j; sell++){
        int cur = dp(i + 1, (j - sell) * x[i + 1]) + sell * y[i];
        ans = max(ans, cur);
    }

    return memo[i][j] = ans;
}

int init(int _n, int _x[], int _y[]){
    n = _n; 

    for(int i = 1; i <= n; i++)
        x[i] = _x[i - 1], y[i] = _y[i - 1];

    memset(memo, -1, sizeof(memo));

    return dp(1, x[1]);
}

Compilation message

/usr/bin/ld: /tmp/ccxV2uM5.o: in function `main':
grader.c:(.text.startup+0x113): undefined reference to `updateX(int, int)'
/usr/bin/ld: grader.c:(.text.startup+0x16d): undefined reference to `updateY(int, int)'
collect2: error: ld returned 1 exit status