이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
///~~~LOTA~~~///
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define append push_back
#define add insert
#define nl '\n'
#define ff first
#define ss second
#define pii pair<int,int>
#define pll pair<ll,ll>
#define all(x) (x).begin(),(x).end()
#define L0TA ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define terminator main
#define N 90000
vector<ll> minimum_costs(vector<int> a,vector<int> l,vector<int> r){
int n,m,o;
n=a.size();
m=l.size();
ll pre[n][n];
ll suf[n][n];
for(int i=0;i<n;i++){
pre[i][i]=o=a[i];
suf[i][i]=0;
for(int j=i-1;j>=0;j--){
o=max(o,a[j]);
pre[i][j]=pre[i][j+1]+o;
}
o=a[i];
for(int j=i+1;j<n;j++){
o=max(o,a[j]);
suf[i][j]=suf[i][j-1]+o;
}
}
ll x;
vector<ll> ans;
for(int i=0;i<m;i++){
x=1e18;
for(int j=l[i];j<=r[i];j++)
x=min(x,pre[j][l[i]]+suf[j][r[i]]);
ans.append(x);
}
return ans;
}
| # | 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... |