Submission #147476

#TimeUsernameProblemLanguageResultExecution timeMemory
147476willi19Holiday (IOI14_holiday)C++14
Compilation error
0 ms0 KiB
#include<holiday.h> long long int findMaxAttraction(int n, int start, int d, int attraction[]) { multiset<long long> s; long long ret=0; for(int i=0;i<(d+1)/2&&start<n;i++,start++) { s.insert(attraction[start]); ret+=attraction[start]; } long long state=ret; d=d/2; while(start<n&&d>0) { s.insert(attraction[start]); state+=attraction[start]; while(s.size()>d) { state-=*(s.begin()); s.erase(s.begin()); } ret=max(ret,state); start++; d--; } return ret; }

Compilation message (stderr)

holiday.cpp: In function 'long long int findMaxAttraction(int, int, int, int*)':
holiday.cpp:3:5: error: 'multiset' was not declared in this scope
     multiset<long long> s;
     ^~~~~~~~
holiday.cpp:3:14: error: expected primary-expression before 'long'
     multiset<long long> s;
              ^~~~
holiday.cpp:7:9: error: 's' was not declared in this scope
         s.insert(attraction[start]);
         ^
holiday.cpp:14:9: error: 's' was not declared in this scope
         s.insert(attraction[start]);
         ^
holiday.cpp:21:13: error: 'max' was not declared in this scope
         ret=max(ret,state);
             ^~~