제출 #992430

#제출 시각아이디문제언어결과실행 시간메모리
992430Yazan_SA모임들 (IOI18_meetings)C++14
0 / 100
55 ms74028 KiB
#include "bits/stdc++.h" using namespace std; vector<vector<int>>mp(3005,vector<int>(3005)); int sol(int x, vector<int> &h, int l, int r) { int ac=0; for(int i=l; i<=r; i++){ ac+=mp[i][x]; } return ac; } void init(vector<int> &h, int n) { for(int i=0; i<n; i++){ int mx=0; for(int j=i; j<n; j++){ mx=max(mx,h[j]); mp[i][j]=mx; mp[j][i]=mx; } } } std::vector<long long> minimum_costs(std::vector<int> H, std::vector<int> L, std::vector<int> R) { vector<long long>ans; int n=(int)H.size(),q=(int)L.size(); assert(n*n*q<1e8); init(H,n); for(int i=0; i<q; i++){ int mn=1e9; for(int x=L[i]; x<=R[i]; x++){ int ts=sol(x,H,L[i],R[i]); mn=min(ts,mn); } ans.push_back(mn); } return ans; } // signed main(){ // for(auto c:minimum_costs({2,4,3,5},{0,1},{2,3}))cout<<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...