제출 #1045294

#제출 시각아이디문제언어결과실행 시간메모리
1045294ArthuroWich휴가 (IOI14_holiday)C++17
47 / 100
5089 ms5480 KiB
#include "holiday.h" #include<bits/stdc++.h> using namespace std; #define int long long int int findMaxAttraction(int32_t n, int32_t st, int32_t d, int32_t at[]) { int ans = 0; for (int l = st; l >= 0; l--) { int co = 0, col = 0; multiset<int> s; if (st-l > d) { break; } for (int i = st; i >= l; i--) { co += at[i]; s.insert(at[i]); } if (s.size() <= d-(st-l)) { ans = max(ans, co); } for (int r = st+1; r < n; r++) { if (st-l+r-st+min(r-st,st-l) > d) { break; } int k = d-(st-l+r-st+min(r-st,st-l)); s.insert(at[r]); co += at[r]; while(s.size() > k) { co -= *s.begin(); s.erase(s.begin()); } ans = max(ans, co); } } return ans; }

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

holiday.cpp: In function 'long long int findMaxAttraction(int32_t, int32_t, int32_t, int32_t*)':
holiday.cpp:17:22: warning: comparison of integer expressions of different signedness: 'std::multiset<long long int>::size_type' {aka 'long unsigned int'} and 'long long int' [-Wsign-compare]
   17 |         if (s.size() <= d-(st-l)) {
      |             ~~~~~~~~~^~~~~~~~~~~
holiday.cpp:27:28: warning: comparison of integer expressions of different signedness: 'std::multiset<long long int>::size_type' {aka 'long unsigned int'} and 'long long int' [-Wsign-compare]
   27 |             while(s.size() > k) {
      |                   ~~~~~~~~~^~~
holiday.cpp:8:21: warning: unused variable 'col' [-Wunused-variable]
    8 |         int co = 0, col = 0;
      |                     ^~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...