Submission #631872

#TimeUsernameProblemLanguageResultExecution timeMemory
631872BlossomstreamCloud Computing (CEOI18_clo)C++14
Compilation error
0 ms0 KiB
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
int n, m;
ll dp[4000][100001];
pair<int, pair<ll, int> >  c[4000];
int main() {
    cin >> n;
    int s = 0;
    for(int i = 0; i < n; i++) {
        cin >> c[i].second.second >> c[i].first >> c[i].second.first;
        c[i].second.first = -c[i].second.first;
        s += c[i].second.second;
    }
    cin >> m;
    for(int i = 0; i < m; i++) {
        cin >> c[i+n].second.second >> c[i+n].first >> c[i+n].second.first;
        c[i+n].second.second = -c[i+n].second.second;
    }
    sort(begin(c), begin(c) + (n + m));
    if(c[m+n-1].second.second > 0) {
        for(int j = 1; j <= c[m+n-1].second.second; j++) {
            dp[m+n-1][j] = c[m+n-1].second.first;
        }
        for(int j = c[m+n-1].second.second + 1; j <= s; j++) {
            dp[m+n-1][j] = LONG_LONG_MIN;
        }
    } else {
        for(int j = 0; j < s; j++) {
            dp[m+n-1][j] = LONG_LONG_MIN;
        }
    }
    for(int i = n+m-2; i >= 0; i--) {
        for(int j = 0; j <= s; j++) {
            if(j - c[i].second.second >= 0 && j - c[i].second.second <= s) {
                dp[i][j] = max(dp[i+1][j], dp[i+1][j-c[i].second.second] + c[i].second.first);
            } else dp[i][j] = dp[i+1][j];
        }
        
    }
    ll ans = 0;
    for(int i = 0; i <= s; i++) {
        ans = max(ans, dp[0][i]);
        
    }
    cout << ans << endl;
}

Compilation message (stderr)

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