이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "meetings.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll linf = ll(1e18);
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int, int> p2;
#define rep(i, high) for (int i = 0; i < high; i++)
#define repp(i, low, high) for (int i = low; i < high; i++)
#define repe(i, container) for (auto& i : container)
#define sz(container) ((int)container.size())
#define all(x) begin(x),end(x)
#if _LOCAL
#define assert(x) if (!(x)) __debugbreak()
#endif
typedef vector<ll> vll;
vll minimum_costs(vi H, std::vector<int> l, std::vector<int> r)
{
vll h(H.begin(), H.end());
int q = sz(l);
vll ret(q);
rep(qu, q)
{
ll ans = linf;
repp(i, l[qu], r[qu] + 1)
{
ll cost = h[i];
ll la = h[i];
repp(j, i+1, r[qu]+1)
{
la = max(la, h[j]);
cost += la;
}
la = h[i];
for (int j = i-1; j >= l[qu]; j--)
{
la = max(la, h[j]);
cost += la;
}
ans = min(ans, cost);
}
ret[qu] = ans;
}
return ret;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |