Submission #51891

#TimeUsernameProblemLanguageResultExecution timeMemory
51891zetapiHoliday (IOI14_holiday)C++14
23 / 100
22 ms5656 KiB
#include <holiday.h> #include <bits/stdc++.h> using namespace std; #define pb push_back #define mp make_pair #define ll long long #define itr ::iterator typedef pair<int,int> pii; const int MAX=1e5; vector<int> attractions; int N; ll findMaxAttraction(int n, int start, int d,int attraction[]) { priority_queue<int,vector<int>,greater<int>> pq; int N=n; ll sum=0,res=0,left=d; for(int A=0;A<N;A++) attractions.pb(attraction[A]); for(int A=0;A<N;A++) { sum+=attractions[A]; pq.push(attractions[A]); while(pq.size()>left) { sum-=pq.top(); pq.pop(); } res=max(res,sum); left--; } return res; } /*signed main() { ios_base::sync_with_stdio(false); cout<<findMaxAttraction()<<"\n"; return 0; }*/

Compilation message (stderr)

holiday.cpp: In function 'long long int findMaxAttraction(int, int, int, int*)':
holiday.cpp:29:18: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   while(pq.size()>left)
         ~~~~~~~~~^~~~~
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...