이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<bits/stdc++.h>
using namespace std;
#define intt long long
#define pb push_back
#define forr(i , x , y) for(int i = x; i <= y;i++)
#define fore(i , n) for(int i = 0 ; i < n;i++)
#define forn(i ,x , y) for(int i = x ; i >= y;i--)
namespace {
int read_int() {
int x;
if (scanf("%d", &x) != 1) {
fprintf(stderr, "Error while reading input\n");
exit(1);
}
return x;
}
} // namespace
const intt INF = 1e18;
vector<long long> minimum_costs(vector<int> H, vector<int> L , vector<int> R)
{
int q = (int)L.size();
vector<intt> ans(q);
fore(i , q)
{
int l = L[i] , r = R[i];
intt best = INF;
forr(x , l , r)
{
int cur = H[x];
intt sm = 0;
forr(j , x , r)
{
cur = max(cur , H[j]);
sm+=cur;
}
cur = H[x];
forn(j , x - 1 , l)
{
cur = max(cur , H[j]);
sm+=cur;
}
best = min(best , sm);
}
ans[i] = best;
}
return ans;
}
컴파일 시 표준 에러 (stderr) 메시지
meetings.cpp:10:9: warning: 'int {anonymous}::read_int()' defined but not used [-Wunused-function]
10 | int read_int() {
| ^~~~~~~~
# | 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... |