답안 #493489

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
493489 2021-12-11T16:13:48 Z Jeff12345121 Peru (RMI20_peru) C++17
컴파일 오류
0 ms 0 KB
#include <bits/stdc++.h>
#define int long long
#define ll int
#include "peru.h"
using namespace std;

const ll nmax = 2005;
const ll P = 1000000007;


ll dp[nmax];
int solve(int N, int K, int* S) {
    for (ll i = 1; i <= N; i++) dp[i] = LLONG_MAX;
    for (ll i = 1; i <= N; i++) {
        ll maxSoFar = -1;
        for (ll j = i - 1; j >= 0 && j >= i - K; j--) {
            maxSoFar = max(maxSoFar, 1LL * S[j]);
            dp[i] = min(dp[i], (dp[j] + maxSoFar));
        }
    }

    int dhs=1, ans=0;
    for(int i=N; i>=1; i--)
    {
        ans+=(dp[i]%P*dhs)%P;
        ans%=P;
        dhs=(dhs*23)%P;
    }
    return ans;
}

Compilation message

/usr/bin/ld: /tmp/ccpS5Lbn.o: in function `main':
grader.cpp:(.text.startup+0x144): undefined reference to `solve(int, int, int*)'
collect2: error: ld returned 1 exit status