제출 #1017207

#제출 시각아이디문제언어결과실행 시간메모리
1017207serkanrashid휴가 (IOI14_holiday)C++14
7 / 100
5074 ms1800 KiB
#include "holiday.h" #include <bits/stdc++.h> using namespace std; struct City { int attr; City(){}; City(int ai) { attr = ai; } bool operator<(const City &ed) const { return attr > ed.attr; } }; long long int findMaxAttraction(int n, int start, int d, int attraction[]) { long long ans = 0; for(int l = 0; l <= start; l++) { for(int r = start; r < n; r++) { int dl = start-l; int dr = r-start; if(dl<dr) swap(dl,dr); int k = dl + 2*dr; k = d - k; if(k<=0) break; vector<int>v; priority_queue<City>q; int br = 0; long long ch = 0; for(int i = l; i <= r; i++) { if(br<k) { br++; ch += attraction[i]; q.push(attraction[i]); } else { if(attraction[i]<=q.top().attr) continue; q.push(attraction[i]); ch += attraction[i]; ch -= q.top().attr; q.pop(); } } ans = max(ans,ch); while(!q.empty()) q.pop(); } } 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...