Submission #67284

#TimeUsernameProblemLanguageResultExecution timeMemory
67284theknife2001Holiday (IOI14_holiday)C++17
0 / 100
31 ms4092 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++) { 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(); ret=max(ans,ret); pq.pop(); 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...