제출 #432795

#제출 시각아이디문제언어결과실행 시간메모리
432795REALITYNB휴가 (IOI14_holiday)C++17
0 / 100
33 ms5276 KiB
#include <bits/stdc++.h> #include "holiday.h" using namespace std; long long findMaxAttraction(int n , int start , int d , int* a){ #define int long long int ans = 0 , sum= 0; multiset<int> el ; for(int i=start;i<n;i++){ el.insert(a[i]) ; sum+=a[i] ; while(el.size()>d){ sum-=*el.begin() ; ans=max(ans,sum); el.erase(el.begin()); } --d; } return ans ; #undef int } /*int main(){ int a[5]= {10,2,20,30,1} ; cout << findMaxAttraction(5,2,7,a) ; return 0 ; } */

컴파일 시 표준 에러 (stderr) 메시지

holiday.cpp: In function 'long long int findMaxAttraction(int, int, int, int*)':
holiday.cpp:11:24: warning: comparison of integer expressions of different signedness: 'std::multiset<long long int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   11 |         while(el.size()>d){
      |               ~~~~~~~~~^~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...