제출 #1362361

#제출 시각아이디문제언어결과실행 시간메모리
1362361vidux휴가 (IOI14_holiday)C++17
23 / 100
9 ms1724 KiB
#include"holiday.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

long long int findMaxAttraction(int n, int start, int d, int a[]) {
	ll ans = 0, cur = 0;
	priority_queue<ll, vector<ll>, greater<ll>> pq;
	for (int i = 0; i < n; i++) {
		pq.push(a[i]);
		cur += a[i];
		d--;
		while (d < 0 && pq.size()) {
			ll v = pq.top(); pq.pop();
			cur -= v;
			d++;
		}
		if (d >= 0) ans = max(ans, cur);
		d--;
	}
	return ans;
}
#결과 실행 시간메모리채점기 출력
결과를 불러오는 중입니다…
#결과 실행 시간메모리채점기 출력
결과를 불러오는 중입니다…
#결과 실행 시간메모리채점기 출력
결과를 불러오는 중입니다…
#결과 실행 시간메모리채점기 출력
결과를 불러오는 중입니다…