Submission #1064419

#TimeUsernameProblemLanguageResultExecution timeMemory
1064419woodHoliday (IOI14_holiday)C++17
7 / 100
5078 ms1704 KiB
#include"holiday.h" #include <bits/stdc++.h> using namespace std; #define vi vector<int> #define ll long long #define pb push_back long long int findMaxAttraction(int n, int start, int d, int attraction[]) { ll result = 0; for (int i = 0; i <= start; ++i) { for(int j = start; j<n; j++){ int dist = j-i+min(j-start,start-i); if(d<dist) continue; vi res; for(int k = i; k<=j;k++){ res.pb(attraction[k]); } sort(res.begin(),res.end(), greater<>()); ll sum = 0; int left = min(d-dist,(int)res.size()); for(int k = 0; k<left; k++){ sum+=res[k]; } result = max(result,sum); } } return result; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...