Submission #636804

#TimeUsernameProblemLanguageResultExecution timeMemory
636804dsabolicCatfish Farm (IOI22_fish)C++17
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; using ll = long long; const int N = 305; ll dp[N][N][2][2]; int n, m; int* x; int* y; int* w; int ima(int i, int j) { auto it = lower_bound(x, x + n, i); if(it == x + n) return 0; if(*it == i && y[it - x] == j) return w[it - x]; else return 0; } ll solve(int i, int hp, bool f1, bool f2) { if(i == n) return 0; ll& ret = dp[i][hp][f1][f2]; if(ret != -1) return ret; ret = 0; if(f2) { for(int h = 0; h <= n; ++h) { if(h == 0) { ret = max(ret, solve(i + 1, 0, 0, 1)); } else { //ret = max(ret, solve(i + 1, 0, 0, 0) + ima(i - 1, h) + ima(i + 1, h)); if(hp == h) ret = max(ret, solve(i + 1, h, 0, 0) + ima(i + 1, h)); else ret = max(ret, solve(i + 1, h, 0, 0) + ima(i + 1, h) + ima(i - 1, h)); } } } else { if(!f1) { for(int h = hp + 1; h <= n; ++h) { ret = max(ret, solve(i + 1, h, 0, 0) + ima(i - 1, h) + ima(i + 1, h)); } } for(int h = hp; h >= 0; --h) { if(h == 0) { ret = max(ret, solve(i + 1, hp, 0, 1)); } else { ret = max(ret, solve(i + 1, h, 1, 0) + ima(i + 1, h) - (h == hp) * ima(i, h)); } } } return ret; } ll max_weights(int n, int m, int* x, int* y, int* w) { memset(dp, -1, sizeof dp); return solve(0, 0, 0, 0); }

Compilation message (stderr)

/usr/bin/ld: /tmp/ccIwhGuD.o: in function `main':
grader.cpp:(.text.startup+0x25e): undefined reference to `max_weights(int, int, std::vector<int, std::allocator<int> >, std::vector<int, std::allocator<int> >, std::vector<int, std::allocator<int> >)'
collect2: error: ld returned 1 exit status