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;
long long a,b,c,d,e,i,j,ii,jj,zx,xc,f[100009],D,pas,jm;
priority_queue <long long> s;
long long int findMaxAttraction(int Nn, int start, int Dd, int attraction[]) {
a=Nn;start++;D=Dd;
for(i=1; i<=a; i++){
f[i]=attraction[i-1];
}
for(i=1; i<=a; i++){
if(i-1>D) break;
s.push(-f[i]);jm+=f[i];
//cout<<"+ "<<f[i]<<"\n";
while(s.size()>max(0LL,D-(i-1))){
jm-=-s.top();
//cout<<"- "<<-s.top()<<"\n";
s.pop();
}
pas=max(pas,jm);
}
return pas;
}
Compilation message (stderr)
holiday.cpp: In function 'long long int findMaxAttraction(int, int, int, int*)':
holiday.cpp:15:17: warning: comparison of integer expressions of different signedness: 'std::priority_queue<long long int>::size_type' {aka 'long unsigned int'} and 'const long long int' [-Wsign-compare]
15 | while(s.size()>max(0LL,D-(i-1))){
| ~~~~~~~~^~~~~~~~~~~~~~~~~
# | 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... |