제출 #915732

#제출 시각아이디문제언어결과실행 시간메모리
915732biank모임들 (IOI18_meetings)C++14
19 / 100
5537 ms6736 KiB
#include "meetings.h" #include <bits/stdc++.h> using namespace std; #define SIZE(x) int(x.size()) #define forn(i,n) for(int i=0;i<int(n);i++) #define forsn(i,s,n) for(int i=int(s);i<int(n);i++) #define dforn(i,n) for(int i=int(n)-1;i>=0;i--) typedef long long ll; typedef vector<ll> vll; typedef vector<int> vi; const ll INF = 1e18; vll minimum_costs(vi h, vi l, vi r) { int q=SIZE(l), n=SIZE(h); vll ans(q,INF); forn(i,n) { vi c(n); c[i]=h[i]; dforn(j,i) c[j]=max(c[j+1],h[j]); forsn(j,i+1,n) c[j]=max(c[j-1],h[j]); vll p(n+1); p[0]=0; forn(j,n) p[j+1]=p[j]+c[j]; forn(j,q) ans[j]=min(ans[j],p[r[j]+1]-p[l[j]]); } 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...