Submission #51907

#TimeUsernameProblemLanguageResultExecution timeMemory
51907zetapiHoliday (IOI14_holiday)C++14
Compilation error
0 ms0 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=5, int start=2, int d=7,int attraction[]) { priority_queue<int,vector<int>,greater<int>> pq; int N=n,left=d; ll sum=0,res=0; for(int A=0;A<N;A++) attractions.pb(attraction[A]); for(int A=start;A>=0;A--) { while(!pq.empty()) pq.pop(); sum=0; left=d; for(int B=start;B>=A;B--) { if(left<=0) break; sum+=attractions[B]; pq.push(attractions[B]); while(pq.size()>left) { sum-=pq.top(); pq.pop(); } res=max(res,sum); left--; } left++; if(left<=0) break; res=max(res,sum); if(A==start) left--; else left-=2; for(int B=start+1;B<N;B++) { if(left<=0) break; sum+=attractions[B]; pq.push(attractions[B]); while(pq.size()>left) { sum-=pq.top(); pq.pop(); } res=max(res,sum); if(B-start<start-A) left-=2; else 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:18:4: error: default argument missing for parameter 4 of 'long long int findMaxAttraction(int, int, int, int*)'
 ll findMaxAttraction(int n=5, int start=2, int d=7,int attraction[])
    ^~~~~~~~~~~~~~~~~
holiday.cpp: In function 'long long int findMaxAttraction(int, int, int, int*)':
holiday.cpp:37:19: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
    while(pq.size()>left)
          ~~~~~~~~~^~~~~
holiday.cpp:59:19: 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;
            ^~~