Submission #1222286

#TimeUsernameProblemLanguageResultExecution timeMemory
1222286__moin__Peru (RMI20_peru)C++20
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; #include "peru.h" #define int long long const int p = 1e9+7; int solve(int n, int k, int* v){ vector<int> dp(n); function<int(int)> get = [&](int idx) { if (idx < 0) return 0ll; return dp[idx]; }; for (int i = 0; i < n; i++) { int curmin = 1e18; int runmax = v[i]; for (int j = i-1; j >= i-k; j--) { curmin = min(curmin, (get(j) + runmax)%p); runmax = max(runmax, (j < 0 ? 0 : v[j])); } dp[i] = curmin; } int factor = 1; int res = 0; for (int i = n-1; i >= 0; i--) { res += (dp[i]*factor) % p; res %= p; factor *= 23; factor %= p; } return res; }

Compilation message (stderr)

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