Submission #584940

#TimeUsernameProblemLanguageResultExecution timeMemory
584940MazaalaiHoliday (IOI14_holiday)C++17
7 / 100
5046 ms10244 KiB
#include <bits/stdc++.h> #include"holiday.h" #define ALL(x) x.begin(),x.end() #define LLA(x) x.rbegin(),x.rend() #define pb push_back using namespace std; using PII = pair <int, int>; using ll = long long; long long int findMaxAttraction(int n, int start, int d, int nums[]) { ll ans = 0; for (int i = 0; i <= start; i++) for (int j = start; j < n; j++) { int l = start - i; int r = j - start; int move = l + r + min(l,r); int need = d - move; if (need <= 0) continue; multiset <int> vals; for (int p = 0; p < need; p++) vals.insert(0); for (int p = i; p <= j; p++) { vals.insert(nums[p]); vals.erase(vals.begin()); } ll cur = 0; for (auto el : vals) cur += el; 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...