제출 #18103

#제출 시각아이디문제언어결과실행 시간메모리
18103comet휴가 (IOI14_holiday)C++98
7 / 100
5000 ms3292 KiB
#include "holiday.h" #include <cstdio> #include <algorithm> #include <queue> using namespace std; typedef long long ll; typedef priority_queue<ll> pq; ll a[100000]; ll b[100000]; ll f(int L,int R,int cnt){ pq Q; for(int i=L;i<=R;i++){ Q.push(a[i]); } ll sum=0; for(int i=0;i<cnt;i++){ if(Q.empty())return sum; sum+=Q.top(); Q.pop(); } return sum; } ll findMaxAttraction(int n, int start, int d, int attraction[]){ for(int i=0;i<n;i++){ a[i]=attraction[i]; } for(int i=start;i<n;i++){ for(int j=start;(start-j)*2+(i-start)<=d;j--){ if(j<0)break; b[i]=max(b[i],f(j,i,d-(start-j)*2-(i-start))); } } for(int i=start;i>=0;i--){ for(int j=start;(j-start)*2+(start-i)<=d;j++){ if(j>=n)break; b[i]=max(b[i],f(i,j,d-(j-start)*2-(start-i))); } } ll ans=0; for(int i=0;i<n;i++)ans=max(ans,b[i]); 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...