# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
284736 | Ozy | Holiday (IOI14_holiday) | C++17 | 2174 ms | 4652 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include"holiday.h"
#include <bits/stdc++.h>
using namespace std;
#define rep(i,a,b) for(int i = (a);i <= (b); i++)
#define debug(a) cerr << #a << " = " << a << endl;
priority_queue<int> cola;
long long int sum,MAX;
long long int findMaxAttraction(int n, int start, int d, int attraction[]) {
int a;
MAX = 0;
sum = 0;
if (start == 0) {
rep(i,0,n-1) {
a = d - i;
debug(a);
if (a > 0) {
while (!cola.empty() && cola.size() > a) {
sum += cola.top();
cola.pop();
}
if (cola.size() == a) {
if (-(cola.top()) < attraction[i]) {
cerr << "reemplace ";
debug(cola.top());
cerr << "meti ";
debug(attraction[i]);
sum += cola.top();
cola.pop();
cola.push(-attraction[i]);
sum += attraction[i];
}
}
else {
cola.push(-attraction[i]);
sum += attraction[i];
cerr << "Meti ";
debug(a);
}
if (sum > MAX) MAX = sum;
}
else return MAX;
cerr << "\n";
}
return MAX;
}
return 0;
}
Compilation message (stderr)
# | 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... |