이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<bits/stdc++.h>
#define ll long long
using namespace std ;
ll h[3005];
ll st[3005*4+1];
void build (ll p , ll l, ll r)
{
if(l==r)
{
st[p]=h[l];
return ;
}
build(2*p,l,(l+r)/2);
build(2*p+1,(l+r)/2 + 1, r);
st[p]=max(st[p*2],st[2*p+1]);
}
ll query(ll p ,ll i , ll j , ll l ,ll r)
{
if(r < i || j < l)
{
return 0;
}
if(l <= i && j <= r)
{
return st[p];
}
ll mid = (i + j) / 2;
ll p1 = query(2*p, i, mid, l, r);
ll p2 = query(2*p+1, mid+1, j, l, r);
return max(p1,p2);
}
vector<ll> minimum_costs(vector<int> H, vector<int>L, vector<int>R)
{
vector<ll>c;
for(int i=0;i<H.size();i++)
{
h[i+1]=H[i];
}
build(1,1,H.size());
for(int i=0;i<L.size();i++)
{
c.push_back(query(1,L[i]+1,R[i]+1,1,H.size()));
}
return c;
}
컴파일 시 표준 에러 (stderr) 메시지
meetings.cpp: In function 'std::vector<long long int> minimum_costs(std::vector<int>, std::vector<int>, std::vector<int>)':
meetings.cpp:37:19: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for(int i=0;i<H.size();i++)
~^~~~~~~~~
meetings.cpp:42:19: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for(int i=0;i<L.size();i++)
~^~~~~~~~~
# | 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... |