제출 #288299

#제출 시각아이디문제언어결과실행 시간메모리
288299andrew모임들 (IOI18_meetings)C++17
0 / 100
1 ms256 KiB
#include <bits/stdc++.h> #include "meetings.h" #define fi first #define se second #define p_b push_back #define m_p make_pair #define sz(x) (int)x.size() #define pii pair <int, int> #define all(x) x.begin(),x.end() using namespace std; typedef long long ll; const ll inf = 1e18; vector<ll> minimum_costs(vector<int> H, vector<int> l, vector<int> r) { int n = sz(H), q = sz(l); vector <ll> ans(q); vector < vector <ll> > pre_calc(n, vector <ll> (n, 0)); for(int x = 0; x < n; x++){ int mx = H[x]; ll sc = 0; for(int j = x; j < n; j++){ mx = max(mx, H[j]); sc += mx; pre_calc[x][j] = sc; } mx = H[x]; sc = 0; for(int j = x; j >= 0; j--){ mx = max(mx, H[j]); sc += mx; pre_calc[x][j] = sc; } } for(int i = 0; i < q; i++){ ans[i] = inf; for(int x = l[i]; x <= r[i]; x++){ ans[i] = min(ans[i], pre_calc[x][l[i]] + pre_calc[x][r[i]]); } } 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...