제출 #584955

#제출 시각아이디문제언어결과실행 시간메모리
584955Mazaalai휴가 (IOI14_holiday)C++17
23 / 100
5036 ms5560 KiB
#include <bits/stdc++.h> #include"holiday.h" #define ALL(x) x.begin(),x.end() #define LLA(x) x.rbegin(),x.rend() #define pb push_back using namespace std; using PII = pair <int, int>; using ll = long long; long long int findMaxAttraction(int n, int start, int d, int nums[]) { ll ans = 0; for (int i = start; i >= 0; i--) { int l = start - i; multiset <int> vals; ll sum = 0; for (int p = i; p <= start; p++) { vals.insert(nums[p]); sum += nums[p]; } // cout << i+1 << "," << start+1 << ": "; // for (auto el : vals) cout << el << ' '; cout << '\n'; for (int j = start+1; j < n; j++) { int r = j - start; int move = l + r + min(l, r); int need = d - move; if (need <= 0) break; vals.insert(nums[j]); sum += nums[j]; while(need < vals.size()) { sum -= *vals.begin(); vals.erase(vals.begin()); } // cout << i+1 << "," << j+1 << ": "; // for (auto el : vals) cout << el << ' '; cout << '\n'; ans = max(ans, sum); } } // cout << "\n"; // for(int i = 0; i < n; i++) cout << nums[i] << " \n"[i==n-1]; return ans; }

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

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