Submission #749934

#TimeUsernameProblemLanguageResultExecution timeMemory
749934Abrar_Al_SamitHoliday (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; }

Compilation message (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...