이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "meetings.h"
#include <bits/stdc++.h>
using namespace std;
int Q,N;
std::vector<long long> minimum_costs(std::vector<int> H, std::vector<int> L, std::vector<int> R) {
Q = L.size(); N = H.size();
vector<long long> C(Q);
for (int q = 0; q < Q; q++) {
int minCost = -1;
for (int x = L[q]; x <= R[q]; x++) {
int cost = 0;
int high = 0;
for (int j = x; j >= L[q]; j--) {
high = max(high,H[j]);
cost += high;
}
high = H[x];
for (int j = x+1; j <= R[q]; j++) {
high = max(high,H[j]);
// cout << high << "\n";
cost += high;
}
// cout << x << " " << cost << "\n";
minCost = (minCost == -1 ? cost : min(cost,minCost));
}
C[q] = minCost;
}
return C;
}
# | 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... |