Submission #639711

#TimeUsernameProblemLanguageResultExecution timeMemory
639711tabrHoliday (IOI14_holiday)C++17
23 / 100
14 ms2084 KiB
#include <bits/stdc++.h> using namespace std; #ifdef tabr #include "library/debug.cpp" #else #define debug(...) #endif long long findMaxAttraction(int n, int s, int d, int a[]) { long long res = (long long) -9e18; assert(s == 0); priority_queue<long long, vector<long long>, greater<long long>> pq; long long sum = 0; for (int i = 0; i < n; i++) { pq.emplace(a[i]); sum += a[i]; while ((int) pq.size() + i > d) { sum -= pq.top(); pq.pop(); } res = max(res, sum); } return res; } #ifdef tabr int main() { ios::sync_with_stdio(false); cin.tie(0); return 0; } #endif
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...