(UPD: 2024-12-04 14:48 UTC) Judge is not working due to Cloudflare incident. (URL) We can do nothing about it, sorry. After the incident is resolved, we will grade all submissions.

Submission #297586

#TimeUsernameProblemLanguageResultExecution timeMemory
297586eohomegrownappsMeetings (IOI18_meetings)C++14
0 / 100
1 ms416 KiB
#include "meetings.h" #include <bits/stdc++.h> using namespace std; typedef long long ll; std::vector<long long> minimum_costs(std::vector<int> H, std::vector<int> L, std::vector<int> R) { ll n = H.size(); vector<vector<ll>> rangemax(n,vector<ll>(n,0)); for (ll l = 0; l<n; l++){ for (ll r = l; r<n; r++){ rangemax[l][r]=max(ll(H[r]),(l==0?0:rangemax[l][r-1])); } } vector<vector<ll>> rangemaxprefsum(n,vector<ll>(n,0)); for (ll r = 0; r<n; r++){ rangemaxprefsum[r][r]=rangemax[r][r]; for (ll l = r-1; l>=0; l--){ rangemaxprefsum[l][r]=rangemaxprefsum[l+1][r]+rangemax[l][r]; } } vector<vector<ll>> rangemaxsuffsum(n,vector<ll>(n,0)); for (ll l = n-1; l>=0; l--){ rangemaxsuffsum[l][l]=rangemax[l][l]; for (ll r = l; r<n; r++){ rangemaxsuffsum[l][r]=rangemaxsuffsum[l][r-1]+rangemax[l][r]; } } ll q = L.size(); vector<ll> ans(q,1e18); for (ll i = 0; i<q; i++){ for (ll x = L[i]; x<=R[i]; x++){ ans[i]=min(ans[i],rangemaxprefsum[L[i]][x]+rangemaxsuffsum[x+1][L[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...