Submission #134595

#TimeUsernameProblemLanguageResultExecution timeMemory
134595mirbek01Holiday (IOI14_holiday)C++11
7 / 100
5080 ms2908 KiB
#include "holiday.h" //#include "grader.cpp" #include <bits/stdc++.h> using namespace std; long long int findMaxAttraction(int n, int start, int d, int ar[]) { long long ans = 0; for(int i = 0; i <= start; i ++){ for(int j = start; j < n; j ++){ int lenA = (start - i), lenB = (j - start); int cnt = d - lenA - lenB - min(lenA, lenB); vector <int> vec; for(int k = i; k <= j; k ++) vec.push_back(ar[k]); sort(vec.rbegin(), vec.rend()); long long ret = 0; for(int k = 0; k < min( (int)vec.size(), cnt ); k ++) ret += vec[k]; ans = max(ans, ret); } } 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...