Submission #834785

#TimeUsernameProblemLanguageResultExecution timeMemory
8347857modyMeetings (IOI18_meetings)C++17
19 / 100
3066 ms786432 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 q=L.size(); int n=H.size(); vector<ll> ans(q,1e18); vector<vector<ll>> arr(n+1,vector<ll>(n+1)); for(int i=0;i<n;i++){ ll maxi=-1; for(int c=i;c>=0;c--){ maxi=max(maxi, ll(H[c])); arr[i][c]=arr[i][c+1]+maxi; } maxi=H[i]; for(int c=i+1;c<n;c++){ maxi=max(maxi, ll(H[c])); arr[i][c]=arr[i][c-1]+maxi; } } for(int i=0;i<q;i++){ for(int j=L[i];j<=R[i];j++) { ans[i]=min(ans[i],arr[j][L[i]]+arr[j][R[i]]-H[j]); } } return ans; } // void solve(){ // } // int main(){ // ios::sync_with_stdio(false);cout.tie();cin.tie(); // int t=1; // cin >> t; // while(t--) solve(); // }
#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...