Submission #1070591

#TimeUsernameProblemLanguageResultExecution timeMemory
1070591MardonbekhazratovHoliday (IOI14_holiday)C++17
7 / 100
5074 ms2860 KiB
#include"holiday.h" #include<algorithm> #include<vector> #define ll long long using namespace std; long long int findMaxAttraction(int n, int start, int d, int attraction[]) { if(d==0) return 0LL; ll ans=0; for(int l=max(0,start-d+1);l<=start;l++){ vector<int>a; for(int r=l;r<n;r++){ int k=(r-start)+(start-l)+min(r-start,start-l); if(k>=d) break; a.push_back(attraction[r]); if(r>=start){ sort(a.begin(),a.end()); ll cur=0; for(int i=a.size()-1;i>=max(0,(int)a.size()-(d-k));i--) cur+=a[i]; ans=max(ans,cur); } } } 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...