제출 #749934

#제출 시각아이디문제언어결과실행 시간메모리
749934Abrar_Al_Samit휴가 (IOI14_holiday)C++17
23 / 100
5045 ms6292 KiB
#include <bits/stdc++.h> #include"holiday.h" using namespace std; long long int findMaxAttraction(int n, int start, int d, int a[]) { multiset<int>list; long long ans = 0; long long cur = 0; for(int i=0; i<n; ++i) { if(i+list.size()>d) { cur -= *list.begin(); list.erase(list.begin()); } if(i+list.size()<d) { list.insert(a[i]); cur += a[i]; } else { if(!list.empty() && *list.begin()<a[i]) { cur -= *list.begin(); list.erase(list.begin()); list.insert(a[i]); cur += a[i]; } } ans = max(ans, cur); } return ans; }

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

holiday.cpp: In function 'long long int findMaxAttraction(int, int, int, int*)':
holiday.cpp:11:25: warning: comparison of integer expressions of different signedness: 'std::multiset<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   11 |         if(i+list.size()>d) {
      |            ~~~~~~~~~~~~~^~
holiday.cpp:16:25: warning: comparison of integer expressions of different signedness: 'std::multiset<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   16 |         if(i+list.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...