Submission #763654

#TimeUsernameProblemLanguageResultExecution timeMemory
763654Ahmed57휴가 (IOI14_holiday)C++17
Compilation error
0 ms0 KiB
#include"holiday.h"

#include <bits/stdc++.h>

using namespace std;
long long int findMaxAttraction(int n, int start, int d,
int attraction[]){
    if(d==0){
        priority_queue<long long> q;
        long long sum = 0 , ma = 0;
        for(int i = 0;i<n;i++){
            q.push(-arr[i]);
            sum+=arr[i];
            while(q.size()>(d-i)){
                sum+=q.top();
                q.pop();
            }
            ma = max(ma,sum);
        }
        return ma;
    }
    return 0;
}
/*
int main(){
    int S[] = {3,4};
    cout<<countReplacement(2,S);
}*/

Compilation message (stderr)

holiday.cpp: In function 'long long int findMaxAttraction(int, int, int, int*)':
holiday.cpp:12:21: error: 'arr' was not declared in this scope
   12 |             q.push(-arr[i]);
      |                     ^~~
holiday.cpp:14:27: warning: comparison of integer expressions of different signedness: 'std::priority_queue<long long int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   14 |             while(q.size()>(d-i)){
      |                   ~~~~~~~~^~~~~~