제출 #847738

#제출 시각아이디문제언어결과실행 시간메모리
847738dubabubaKnapsack (NOI18_knapsack)C++14
컴파일 에러
0 ms0 KiB
#include<bits/stdc++.h>
using namespace std;

#define int long long

const int mxn = 1e6 + 10;
const int mxs = 2000 + 9;
int dp[mxn][mxs], n, s, ans;
int pr[mxn], we[mxn], am[mxn];

signed main() {
	cin.tie(0)->sync_with_stdio(0);

	cin >> s >> n;
	for(int i = 1; i <= n; i++)
		cin >> pr[i] >> we[i] >> am[i];

	for(int i = 1; i <= n; i++)
	for(int j = 0; j <= s; j++) {
		for(int k = 0; k <= am[i] && k * we[i] <= j; k++)
			dp[i][j] = max(dp[i][j], dp[i-1][j - we[i] * k] + pr[i] * k);
		ans = max(ans, dp[i][j]);
	}

	cout << ans << '\n';
	return 0;
}

컴파일 시 표준 에러 (stderr) 메시지

/usr/bin/ld: failed to convert GOTPCREL relocation; relink with --no-relax
collect2: error: ld returned 1 exit status