Submission #782180

#TimeUsernameProblemLanguageResultExecution timeMemory
782180I_Love_EliskaM_Holiday (IOI14_holiday)C++14
47 / 100
5068 ms2388 KiB
#include "holiday.h" #include <bits/stdc++.h> using namespace std; #define forn(i,n) for(int i=0;i<n;++i) #define pb push_back #define all(x) x.begin(),x.end() #define pi pair<int,int> #define f first #define s second using ll = long long; const int inf=1e9; ll findMaxAttraction(int n, int s, int d, int b[]) { vector<int> a(n); forn(i,n) a[i]=b[i]; ll ans=0; int D=d; for (int l=s; l>=0; --l) { if (!d) break; ll sum=0; priority_queue<int> q; for (int j=l; j<min(l+d,n); ++j) { sum+=a[j]; q.push(-a[j]); while (q.size()+j-l > d) { sum+=q.top(); q.pop(); } ans=max(ans,sum); } --d; } if (s==0) return ans; reverse(all(a)); s=n-1-s; d=D; for (int l=s; l>=0; --l) { if (!d) break; ll sum=0; priority_queue<int> q; for (int j=l; j<min(l+d,n); ++j) { sum+=a[j]; q.push(-a[j]); while (q.size()+j-l > d) { sum+=q.top(); q.pop(); } ans=max(ans,sum); } --d; } return ans; }

Compilation message (stderr)

holiday.cpp: In function 'll findMaxAttraction(int, int, int, int*)':
holiday.cpp:24:27: warning: comparison of integer expressions of different signedness: 'std::priority_queue<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   24 |       while (q.size()+j-l > d) {
      |              ~~~~~~~~~~~~~^~~
holiday.cpp:42:27: warning: comparison of integer expressions of different signedness: 'std::priority_queue<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   42 |       while (q.size()+j-l > 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...