Submission #700017

#TimeUsernameProblemLanguageResultExecution timeMemory
700017n1kCatfish Farm (IOI22_fish)C++17
Compilation error
0 ms0 KiB
#include <bits/stdc++.h>

#define ll long long
#define vt vector
#define pb push_back
#define ar array
#define all(x) (x).begin(), (x).end()
#define sz(x) (x).size()

using namespace std;

/*
 1. simplify
 2. add new elements
 3. brute force solution
 4. optimize
*/

// --- templates ---

// --- code ---

ll max_weights(int n, int m, int X[], int Y[], int W[]){
	vt<ll> a(n);
	for(int i = 0; i < m; i++){
		a[X[i]] = W[i];
	}
	vt<ll> dp(n);
	for(int i = 0; i < n; i++){
		dp[i] = max((i ? a[i - 1] : 0) + (i >= 2 ? dp[i - 2] : 0) + (i == n - 2 ? a[i + 1] : 0), 
					(i ? dp[i - 1] : 0));
	} 
	return 0;
}

Compilation message (stderr)

/usr/bin/ld: /tmp/ccvACsGh.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