Submission #1017205

#TimeUsernameProblemLanguageResultExecution timeMemory
1017205serkanrashidHoliday (IOI14_holiday)C++14
7 / 100
5087 ms2720 KiB
#include "holiday.h" #include <bits/stdc++.h> using namespace std; 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; for(int i = l; i <= r; i++) v.push_back(attraction[i]); sort(v.begin(),v.end()); long long ch = 0; for(int i = v.size()-1; i >= max((int)0,(int)v.size()-k); i--) ch += v[i]; ans = max(ans,ch); } } 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...