이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "holiday.h"
#include <bits/stdc++.h>
using namespace std;
const int MAXN = 2e5;
typedef long long int ll;
int f[MAXN];
long long int findMaxAttraction(int n, int start, int d, int a[]) {
ll ans = 0;
priority_queue<int,vector<int>,greater<int>>pq;
int cost = -1;
ll sum = 0;
if(start == 0){
for(int i=0;i<n;i++){
cost++;
sum+=a[i];
pq.push(a[i]);
cost++;
while(!pq.empty() && cost > d){
cost--;
sum-=pq.top();
pq.pop();
}
if(cost > d)break;
ans = max(ans,sum);
//cout<<cost<<" "<<pq.size()<<'\n';
}
}
return ans;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |