제출 #763654

#제출 시각아이디문제언어결과실행 시간메모리
763654Ahmed57휴가 (IOI14_holiday)C++17
컴파일 에러
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); }*/

컴파일 시 표준 에러 (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)){
      |                   ~~~~~~~~^~~~~~