제출 #110416

#제출 시각아이디문제언어결과실행 시간메모리
110416ioilolcom쌀 창고 (IOI11_ricehub)C++14
17 / 100
1076 ms1696 KiB
#include <bits/stdc++.h> #include "ricehub.h" using namespace std; #define endl "\n" #define x first #define y second #define pii pair<ll,ll> typedef long long int ll; vector<int> v; int besthub(int R, int L, int X[], long long B) { int n=R; ll w=B; v.resize(n+1); for(int i=0; i<n; i++) { v[i+1]=X[i]; } ll mx=0; for(int idx=1; idx<=n; idx++) { vector<pii> l,r; ll cur=0; ll curv=0; for(int i=idx+1; i<=n; i++) { curv+=v[i]-v[idx]; cur++; r.push_back({curv,cur}); } r.push_back({0,0}); l.push_back({0,0}); cur=0; curv=0; for(int i=idx-1; i>=0; i--) { curv+=abs(v[i]-v[idx]); cur++; l.push_back({curv,cur}); } ll ans=0; for(pii u:l) { for(pii v:r) { if(u.x+v.x<=w) { ans=max(ans,u.y+v.y); } } } ans++; mx=max(mx,ans); } return mx; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...