Submission #601664

#TimeUsernameProblemLanguageResultExecution timeMemory
601664MazaalaiMeetings (IOI18_meetings)C++17
Compilation error
0 ms0 KiB
#include "meetings.h"
#include <bits/stdc++.h>
#define sz(x) (int)x.size()
#define ALL(x) x.begin(), x.end()
#define chmax(a, b) a=max(a,b)
#define chmin(a, b) a=min(a,b)
#define pb push_back
#define ff first
#define ss second
using namespace std;
using ll = long long;
using VI = vector <int>;
using PII = pair <int, int>;
int n, m, q;
const int N = 4e5;
vector<long long> ans;
ll dp[N][N];
vector<long long> minimum_costs(vector<int> h, vector<int> L, vector<int> R) {
    n = sz(h);
    q = sz(L);
    ans.reserve(q);
    for (int i = 0; i < n; i++) {
        for (int j = i, cur = 0; j < n; j++) {
            cur = chmax(cur, h[j]);
            dp[i][j] = cur;
            if (j > i) dp[i][j] += dp[i][j-1];
        }
        for (int j = i, cur = 0; j >= 0; j--) {
            cur = chmax(cur, h[j]);
            dp[i][j] = cur;
            if (j < i) dp[i][j] += dp[i][j+1];
        }
    }
    for (int i = 0; i < q; i++) {
        int l = L[i], r = R[i];
        ll res = 1e18;
        for (int mid = l; mid <= r; mid++) {
            chmin(res, dp[mid][l]+dp[mid][r]-h[mid]);
        }
        ans.pb(res);
    }
    return ans;
}

Compilation message (stderr)

meetings.cpp: In function 'std::vector<long long int> minimum_costs(std::vector<int>, std::vector<int>, std::vector<int>)':
meetings.cpp:24:17: warning: operation on 'cur' may be undefined [-Wsequence-point]
   24 |             cur = chmax(cur, h[j]);
      |                 ^
meetings.cpp:29:17: warning: operation on 'cur' may be undefined [-Wsequence-point]
   29 |             cur = chmax(cur, h[j]);
      |                 ^
/usr/lib/gcc/x86_64-linux-gnu/10/libstdc++.a(vterminate.o): in function `__gnu_cxx::__verbose_terminate_handler()':
(.text._ZN9__gnu_cxx27__verbose_terminate_handlerEv+0x1e): relocation truncated to fit: R_X86_64_PC32 against `.bss._ZZN9__gnu_cxx27__verbose_terminate_handlerEvE11terminating'
(.text._ZN9__gnu_cxx27__verbose_terminate_handlerEv+0x2b): relocation truncated to fit: R_X86_64_PC32 against `.bss._ZZN9__gnu_cxx27__verbose_terminate_handlerEvE11terminating'
/usr/bin/ld: failed to convert GOTPCREL relocation; relink with --no-relax
collect2: error: ld returned 1 exit status