이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "meetings.h"
#include <bits/stdc++.h>
#define mp make_pair
#define f first
#define s second
#define sz(x) (int)(x).size()
#define rsz resize
#define ins insert
#define ft front()
#define bk back()
#define pf push_front
#define pb push_back
#define eb emplace_back
#define lb lower_bound
#define ub upper_bound
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pi;
typedef pair<ll,ll> pl;
typedef vector<int> vi;
typedef vector<bool> vb;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;
template<class T>bool tmin(T& a,T b){if(a>b){a=b;return 1;}return 0;}
template<class T>bool tmax(T& a,T b){if(a<b){a=b;return 1;}return 0;}
int tree[5005][5005];
ll jem[5005][5005];
vl C;
std::vector<long long> minimum_costs(std::vector<int> H, std::vector<int> L,std::vector<int> R)
{
for (int i=0;i<sz(H);i++)
{
int mx=0;
for (int j=i;j>=0;j--)
{
mx=max(mx,H[j]);
tree[i][j]=mx;
}
mx=0;
for (int j=i;j<sz(H);j++)
{
mx=max(mx,H[j]);
tree[i][j]=mx;
}
}
for (int i=0;i<sz(H);i++)
{
jem[i][0]=tree[i][0];
for (int j=1;j<sz(H);j++)
{
jem[i][j]=jem[i][j-1]+tree[i][j];
}
}
for (int i=0;i<sz(L);i++)
{
ll res=1000000000000000000;
if (L[i]==0) for (int j=L[i];j<=R[i];j++) res=min(res,jem[j][R[i]]);
else for (int j=L[i];j<=R[i];j++) res=min(res,jem[j][R[i]]-jem[j][L[i]-1]);
C.pb(res);
}
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... |