Submission #609533

#TimeUsernameProblemLanguageResultExecution timeMemory
609533AmirElarbiMeetings (IOI18_meetings)C++14
0 / 100
506 ms620896 KiB
#include <bits/stdc++.h> #define vi vector<int> #define gi greater<int> #define gr greater #define ve vector #define ll long long #define vf vector<float> #define vll vector<pair<ll,ll>> #define ii pair<int,int> #define pll pair<ll,ll> #define vvi vector<vi> #define vii vector<ii> #define gii greater<ii> #define pb push_back #define mp make_pair #define fi first #define se second #define INF 1e9 #define eps 1e-7 #define eps1 1e-2 #define optimise ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL); #define MAX_A 2e5+5 using namespace std; const int MOD = 1e9+7; const int nax = 5005+5; typedef complex<int> Point; //#define X real() //#define Y imag() #include "meetings.h" ll lft[nax][nax], rght[nax][nax]; ve<ll> minimum_costs(vi h, vi l, vi r) { int n = h.size(); for (int i = 0; i < n; ++i) { int mx = h[i]; lft[i][i] = rght[i][i] = h[i]; for (int j = i-1; j >= 0; --j) { mx = max(mx,h[j]); lft[i][j] += lft[i][j+1] + mx; } mx = h[i]; for (int j = i+1; j < n; ++j) { mx = max(mx,h[j]); rght[i][j] += rght[i][j-1] + mx; } } int q = l.size(); ve<ll> ans(q); for (int j = 0; j < q; ++j) { ll mn = INF; for (int i = l[j]; i <= r[j]; ++i) { ll res = lft[i][l[j]] + rght[i][r[j]] - h[i]; mn = min(mn,res); } ans[j] = mn; } return ans; }
#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...