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

#TimeUsernameProblemLanguageResultExecution timeMemory
120150BoxworldMeetings (IOI18_meetings)C++14
0 / 100
449 ms400024 KiB
#include <bits/stdc++.h> using namespace std; #include "meetings.h" typedef long long LL; vector<int> h; int N,Q; LL Dp[5010][5010]; int findmax(int l,int r){ int M=l; for (int i=l;i<=r;i++) if(h[i]>h[M])M=i; return M; } LL dp(int l,int r){ if(l>r)return 0; if (Dp[l][r]>0)return Dp[l][r]; if(l==r)return Dp[l][r]=h[l]; int x=findmax(l,r); return Dp[l][r]=min(dp(l,x-1)+h[x]*(r-x+1),dp(x+1,r)+h[x]*(x-l+1)); } vector<LL> minimum_costs(vector<int> H,vector<int> L,vector<int> R) { N=H.size(),Q=L.size(); h=H; vector<LL> C; memset(Dp,0,sizeof(Dp)); for (int q=0;q<Q;q++){ C.push_back(dp(L[q],R[q])); } 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...