This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <utility>
#include <algorithm>
#include <math.h>
#include <vector>
#include <set>
#include <iostream>
//#include "job.h"
#include "meetings.h"
#define fori(i,n) for(int i=0;i<n;i++)
#define forn(i,n) for(int i=1;i<n;i++)
#define fort(i,m,n) for(int i=m;i<n;i++)
#define forib(i,n) for(int i=n-1;i>=0;i--)
#define fornb(i,n) for(int i=n-1;i>0;i--)
#define maxl 1e18
#define con continue;
typedef long long lol;
using namespace std;
typedef vector<int> veci;
typedef vector<lol> vecl;
typedef pair<lol,lol> point;
lol sum=0;
vecl minimum_costs(veci H, veci L,veci R) {
int n=H.size();
vector<veci> a(n,veci(n));
vector<vecl> b(n,vecl(n+1));
fori(i,n){
a[i][i]=H[i];
forib(j,i){
a[i][j]=max(a[i][j+1],H[j]);
}
fort(j,i+1,n){
a[i][j]=max(a[i][j-1],H[j]);
}
fori(j,n){
b[i][j+1]=b[i][j]+a[i][j];
}
}
int Q = L.size();
vector<long long> C(Q);
for (int j = 0; j < Q; ++j) {
C[j]=maxl;
fort(i,L[j],R[j]+1){
C[j]=min(C[j],b[i][R[j]+1]-b[i][L[j]]);
}
}
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... |