Submission #69749

#TimeUsernameProblemLanguageResultExecution timeMemory
69749E869120Holiday (IOI14_holiday)C++14
47 / 100
5075 ms4600 KiB
#include"holiday.h" #include <queue> #include <algorithm> #include <functional> #include <vector> using namespace std; priority_queue<long long, vector<long long>, greater<long long>> Q; long long int findMaxAttraction(int n, int start, int d, int attraction[]) { long long maxn = 0; for (int i = 0; i <= start; i++) { while (!Q.empty()) Q.pop(); long long val = 0; for (int j = i; j < n; j++) { val += attraction[j]; Q.push(attraction[j]); if (j >= start) { long long cost = (j - i) + min(j - start, start - i); while (!Q.empty() && (int)Q.size() > d - cost) { val -= Q.top(); Q.pop(); } maxn = max(maxn, val); } } } return maxn; }

Compilation message (stderr)

grader.cpp: In function 'int main()':
grader.cpp:7:12: warning: variable 'n_s' set but not used [-Wunused-but-set-variable]
     int i, n_s;
            ^~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...