(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 #427167

#TimeUsernameProblemLanguageResultExecution timeMemory
427167AmineTrabelsiMeetings (IOI18_meetings)C++14
0 / 100
5584 ms2180 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 Q = L.size(); vector<long long> C(Q); auto mx = [&](int l,int r){ int res = 0; for(int i=l;i<=r;i++)res = max(res,H[i]); return res; }; auto choose = [&](int ind,int l,int r){ long long res = 0; for(int i=l;i<=r;i++){ if(i <= ind)res += mx(i,ind); else res += mx(ind,i); } return res; }; for(int i=0;i<Q;i++){ int l = L[i], r = R[i]; long long ans =1e18; //cerr<<i<<": "; for(int j=l;j<=r;j++){ ans = min(ans,choose(j,l,r)); //cerr<<j<<" "<<ans<<'\n'; } C[i] = 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...