Submission #15838

#TimeUsernameProblemLanguageResultExecution timeMemory
15838myungwooHoliday (IOI14_holiday)C++14
23 / 100
22 ms3152 KiB
#include <bits/stdc++.h> using namespace std; #define MAXN 100005 typedef long long lld; static int N, S, T; static int A[MAXN]; lld findMaxAttraction(int n, int start, int d, int arr[]) { if (start) return 0; N = n; S = start; T = d; for (int i=1;i<=N;i++) A[i] = arr[i-1]; priority_queue <int> que; int left = T; lld ret = 0, sum = 0; for (int i=1;i<=N;i++){ if (!left){ if (que.empty()) break; int q = que.top(); que.pop(); sum += q; left++; } sum += A[i]; que.push(-A[i]); left--; ret = max(ret, sum); if (!left){ if (que.empty()) break; int q = que.top(); que.pop(); sum += q; left++; } left--; } return ret; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...