제출 #550557

#제출 시각아이디문제언어결과실행 시간메모리
550557CSQ31휴가 (IOI14_holiday)C++17
23 / 100
16 ms1616 KiB
#include "holiday.h" #include <bits/stdc++.h> using namespace std; const int MAXN = 2e5; typedef long long int ll; int f[MAXN]; long long int findMaxAttraction(int n, int start, int d, int a[]) { ll ans = 0; priority_queue<int,vector<int>,greater<int>>pq; int cost = -1; ll sum = 0; if(start == 0){ for(int i=0;i<n;i++){ cost++; sum+=a[i]; pq.push(a[i]); cost++; while(!pq.empty() && cost > d){ cost--; sum-=pq.top(); pq.pop(); } if(cost > d)break; ans = max(ans,sum); //cout<<cost<<" "<<pq.size()<<'\n'; } } return ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...