Submission #386541

# Submission time Handle Problem Language Result Execution time Memory
386541 2021-04-06T18:56:23 Z Uncreative Kitchen (BOI19_kitchen) C++14
Compilation error
0 ms 0 KB
#include<iostream>
#include<algorithm>

using namespace std;

int n, m, k;
const int maxn = 1010;
const int inf = maxn * maxn + 400;

int a[maxn];
int az = 0;

int b[maxn];

int dp[maxn][inf];

int sol = inf;

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cin >> n >> m >> k;
    int r = 0;
    for (int i = 0; i < n; i++){
        cin >> a[i];
        az += a[i];
        if (a[i] < k){
            r = 1;
        }
    }
    for (int i = 0; i < m; i++){
        cin >> b[i];
    }
    for (int i = m - 1; i >= 0; i--){
        for (int j = maxn * maxn; j >= 0; j--){
            dp[i][j] = dp[i + 1][j];
            dp[i][j + b[i]] = max(dp[i][j + b[i]], dp[i + 1][j] + min(n, b[i]));
        }
    }
    for (int j = maxn * maxn; j >= 0; j--){
        if (dp[0][j] >= k * n && j >= az){
            sol = min(sol, j);
        }
    }
    if (r == 0 && sol != inf){
        cout << sol - az;
    }
    else {
        cout << "Impossible";
    }
}

Compilation message

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