제출 #129495

#제출 시각아이디문제언어결과실행 시간메모리
129495antimirage휴가 (IOI14_holiday)C++14
23 / 100
46 ms6328 KiB
#include"holiday.h" #include <bits/stdc++.h> using namespace std; multiset <int> st; long long int findMaxAttraction(int n, int start, int d, int a[]) { long long ans = 0, sum = 0; for (int i = 0; i < n; i++) { if (i >= d) break; st.insert(a[i]); sum += a[i]; int k = d - i; while (st.size() > k) { sum -= *st.begin(); st.erase(st.begin()); } ans = max(ans, sum); } return ans; }

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

holiday.cpp: In function 'long long int findMaxAttraction(int, int, int, int*)':
holiday.cpp:17:20: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   while (st.size() > k) {
          ~~~~~~~~~~^~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...