Submission #67286

#TimeUsernameProblemLanguageResultExecution timeMemory
67286theknife2001Holiday (IOI14_holiday)C++17
23 / 100
20 ms2552 KiB
#include"holiday.h" #include <bits/stdc++.h> using namespace std; priority_queue < int , vector < int > , greater < int > > pq; long long int findMaxAttraction(int n, int start, int d, int a[]) { if(!d) return 0; d--; int x=d/2; d-=x*2; long long ans=0; for(int i=0;i<=x&&i<n;i++) { pq.push(a[i]); ans+=a[i]; } long long ret=ans; for(int i=x+1;i<n&&pq.size();i++) { if(!d) { ans-=pq.top(); pq.pop(); } else d--; if(pq.size()&&a[i]>pq.top()) { ans+=a[i]-pq.top(); pq.pop(); ret=max(ans,ret); pq.push(a[i]); } } return ret; }

Compilation message (stderr)

grader.cpp: In function 'int main()':
grader.cpp:7:12: warning: variable 'n_s' set but not used [-Wunused-but-set-variable]
     int i, n_s;
            ^~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...