이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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
#define REP(i,a) for (int i = 0; i < (a); ++i)
#define FOR(i,a,b) for (int i = (a); i <= (b); ++i)
#define F0R(i,a) FOR(i,0,a)
#define trav(a,x) for (auto& a: x)
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;
const int N=2e5+1;
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;}
vector<long long> minimum_costs(std::vector<int> H, std::vector<int> L, std::vector<int> R)
{
vl v;
REP(i,sz(L))
{
ll res=INT_MAX;
FOR(j,L[i],R[i])
{
ll jem=0;
int mx=0;
for (ll l=j;l>=L[i];l--)
{
mx=max(mx,H[l]);
jem+=mx;
}
mx=0;
for (ll l=j;l<=R[i];l++)
{
mx=max(mx,H[l]);
jem+=mx;
}
res=min(res,jem);
}
v.pb(res);
}
return v;
}
# | 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... |