제출 #432798

#제출 시각아이디문제언어결과실행 시간메모리
432798REALITYNB휴가 (IOI14_holiday)C++17
23 / 100
45 ms5552 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() ; el.erase(el.begin()); } ans=max(ans,sum); --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...