제출 #499743

#제출 시각아이디문제언어결과실행 시간메모리
499743dxz05휴가 (IOI14_holiday)C++14
47 / 100
5073 ms5336 KiB
#include"holiday.h" #include <bits/stdc++.h> using namespace std; typedef long long ll; long long findMaxAttraction(int n, int start, int d, int attraction[]) { ll ans = 0; for (int l = 0; l <= start; l++){ multiset<int> s; ll sum = 0; for (int r = l; r < n; r++){ s.insert(attraction[r]); sum += attraction[r]; if (r < start) continue; int free = d - (r - l); free -= min(r - start, start - l); if (free <= 0) break; while (s.size() > free){ sum -= *s.begin(); s.erase(s.begin()); } ans = max(ans, sum); } } return ans; }

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

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