Submission #111887

#TimeUsernameProblemLanguageResultExecution timeMemory
111887mechfrog88Meetings (IOI18_meetings)C++14
19 / 100
5582 ms504596 KiB
#include "meetings.h" #include <bits/stdc++.h> using namespace std; typedef long long ll; vector<ll> minimum_costs(vector<int> h,vector<int> l,vector<int> r) { int n = l.size(); ll a = h.size(); vector<ll> c(n); vector <vector<ll>> d(a,vector<ll>(a,0)); for (int z=0;z<a;z++){ ll maxi = h[z]; d[z][z] = h[z]; for (int x=z+1;x<a;x++){ maxi = max(maxi,ll(h[x])); d[z][x] = d[z][x-1] + maxi; } maxi = h[z]; for (int x=z-1;x>-1;x--){ maxi = max(maxi,ll(h[x])); d[z][x] = d[z][x+1] + maxi; } } for (int z=0;z<n;z++){ ll left = l[z]; ll right = r[z]; c[z] = LLONG_MAX; for (int x=left;x<=right;x++){ c[z] = min(c[z],d[x][right]+d[x][left]-ll(h[x])); } } return c; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...