이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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;
ll dp[N][N];
vector<long long> minimum_costs(vector<int> h, vector<int> L, vector<int> R) {
n = sz(h);
q = sz(L);
vector<long long> ans(q);
for (int i = 0; i < n; i++) {
for (int j = i, cur = 0; j < n; j++) {
cur = max(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 = max(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;
}
컴파일 시 표준 에러 (stderr) 메시지
/tmp/ccx62Mkl.o: in function `minimum_costs(std::vector<int, std::allocator<int> >, std::vector<int, std::allocator<int> >, std::vector<int, std::allocator<int> >)':
meetings.cpp:(.text+0x52): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/ccx62Mkl.o
meetings.cpp:(.text+0x5f): relocation truncated to fit: R_X86_64_PC32 against symbol `q' defined in .bss section in /tmp/ccx62Mkl.o
meetings.cpp:(.text+0xcb): relocation truncated to fit: R_X86_64_PC32 against symbol `q' defined in .bss section in /tmp/ccx62Mkl.o
meetings.cpp:(.text+0xd2): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/ccx62Mkl.o
meetings.cpp:(.text+0x273): relocation truncated to fit: R_X86_64_PC32 against symbol `q' defined in .bss section in /tmp/ccx62Mkl.o
meetings.cpp:(.text+0x2a4): relocation truncated to fit: R_X86_64_PC32 against symbol `q' defined in .bss section in /tmp/ccx62Mkl.o
meetings.cpp:(.text+0x301): relocation truncated to fit: R_X86_64_PC32 against symbol `q' defined in .bss section in /tmp/ccx62Mkl.o
meetings.cpp:(.text+0x308): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/ccx62Mkl.o
/tmp/ccx62Mkl.o: in function `_GLOBAL__sub_I_n':
meetings.cpp:(.text.startup+0xb): relocation truncated to fit: R_X86_64_PC32 against `.bss'
meetings.cpp:(.text.startup+0x29): relocation truncated to fit: R_X86_64_PC32 against `.bss'
/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): additional relocation overflows omitted from the output
/usr/bin/ld: failed to convert GOTPCREL relocation; relink with --no-relax
collect2: error: ld returned 1 exit status