Submission #944169

#TimeUsernameProblemLanguageResultExecution timeMemory
944169beepbeepsheepMeetings (IOI18_meetings)C++17
0 / 100
10 ms2396 KiB
#include "meetings.h" #include <bits/stdc++.h> using namespace std; #define ll long long const ll inf=1e18; ll arr[105][105]; std::vector<long long> minimum_costs(std::vector<int> H, std::vector<int> L, std::vector<int> R) { ll n=H.size(); ll q=L.size(); vector<ll> ans; for (int i=0;i<n;i++){ arr[i][i]=H[i]; for (int j=i-1;j>=0;j--){ arr[i][j]=max<ll>(arr[i][j+1],H[j]); } for (int j=i+1;j<n;j++){ arr[i][j]=max<ll>(arr[i][j-1],H[j]); } for (int j=1;j<n;j++){ arr[i][j]+=arr[i][j-1]; } } for (int i=0;i<q;i++){ ll tot=inf; for (int j=L[i];j<=R[i];j++){ if (L[i]!=0) tot=min(tot,arr[j][R[i]]-arr[j][L[i]-1]); else tot=min(tot,arr[j][R[i]]); } ans.emplace_back(tot); } 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...