Submission #624632

#TimeUsernameProblemLanguageResultExecution timeMemory
624632moyindavidMeetings (IOI18_meetings)C++17
4 / 100
5536 ms253308 KiB
#include "meetings.h" #include <bits/stdc++.h> using namespace std; vector<long long> minimum_costs(vector<int> H, vector<int> L,vector<int> R) { int n=H.size(),cost[n][n]; for(int i=0;i<n;i++){ cost[i][i]=H[i]; for(int j=i+1;j<n;j++)cost[i][j]=max(cost[i][j-1],H[j]); } for(int i=n-1;i>=0;i--){ for(int j=i-1;j>=0;j--)cost[i][j]=max(cost[i][j+1],H[j]); } int Q = L.size(); vector<long long> C(Q); long long ans = 3000000000007,temp=0; for (int j = 0; j < Q; ++j) { ans = 3000000000007; for(int i=L[j];i<=R[j];i++){ temp=0; for(int k=L[j];k<=R[j];k++){ temp+=cost[k][i]; } ans=min(ans,temp); } C[j]=ans; } 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...