Submission #147477

#TimeUsernameProblemLanguageResultExecution timeMemory
147477willi19Holiday (IOI14_holiday)C++14
Compilation error
0 ms0 KiB
#include<holiday.h> #include<bits/stdc++.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:4:5: error: 'multiset' was not declared in this scope
     multiset<long long> s;
     ^~~~~~~~
holiday.cpp:4:5: note: suggested alternative:
In file included from /usr/include/c++/7/set:61:0,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:87,
                 from holiday.cpp:2:
/usr/include/c++/7/bits/stl_set.h:69:11: note:   'std::multiset'
     class multiset;
           ^~~~~~~~
holiday.cpp:4:14: error: expected primary-expression before 'long'
     multiset<long long> s;
              ^~~~
holiday.cpp:8:9: error: 's' was not declared in this scope
         s.insert(attraction[start]);
         ^
holiday.cpp:15:9: error: 's' was not declared in this scope
         s.insert(attraction[start]);
         ^
holiday.cpp:22:13: error: 'max' was not declared in this scope
         ret=max(ret,state);
             ^~~
holiday.cpp:22:13: note: suggested alternative:
In file included from /usr/include/c++/7/algorithm:62:0,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:65,
                 from holiday.cpp:2:
/usr/include/c++/7/bits/stl_algo.h:3468:5: note:   'std::max'
     max(initializer_list<_Tp> __l, _Compare __comp)
     ^~~