Submission #586572

#TimeUsernameProblemLanguageResultExecution timeMemory
586572SeDunionHoliday (IOI14_holiday)C++17
Compilation error
0 ms0 KiB
#include"holiday.h" #include<algorithm> #include<iostream> #include<vector> using namespace std; using ll = long long; int cnt[111]; ll findMaxAttraction(int n, int start, int d, int attraction[]) { ll ans = 0; for (int i = 0 ; i < n ; ++ i) { cnt[attraction[i]]++; int x = d - i; ll cur = 0; for (int y = 100 ; y >= 0 ; -- y) { int q = min(cnt[y], x); x -= q;#include"holiday.h" #include<algorithm> #include<iostream> #include<vector> #include<set> using namespace std; using ll = long long; const int N = 222; const int D = 2*N + N/2; ll sum = 0; multiset<ll>st; ll findMaxAttraction(int n, int start, int d, int attraction[]) { ll ans = 0; for (int _ = 0 ; _ < 2 ; ++ _) { for (int i = start ; i < n ; ++ i) { int x = d - (i - start); st.clear(); sum = 0; for (int j = i ; j >= 0 ; -- j) { sum += attraction[j]; st.insert(attraction[j]); int y = x - (i - j); if (y < 0) break; while ((int)st.size() > y) { sum -= *st.begin(); st.erase(st.begin()); } ans = max(ans, sum); } } reverse(attraction, attraction + n); start = n - start - 1; } return ans; } cur += q * y; } ans = max(ans, cur); } return ans; }

Compilation message (stderr)

holiday.cpp:19:11: error: stray '#' in program
   19 |    x -= q;#include"holiday.h"
      |           ^
holiday.cpp: In function 'll findMaxAttraction(int, int, int, int*)':
holiday.cpp:19:12: error: 'include' was not declared in this scope
   19 |    x -= q;#include"holiday.h"
      |            ^~~~~~~
In file included from /usr/include/c++/10/utility:68,
                 from /usr/include/c++/10/algorithm:60,
                 from holiday.cpp:2:
/usr/include/c++/10/bits/stl_set.h:64:15: error: expected '=' before '__attribute__'
   64 | namespace std _GLIBCXX_VISIBILITY(default)
      |               ^~~~~~~~~~~~~~~~~~~
/usr/include/c++/10/bits/stl_set.h:64:15: error: expected identifier before '__attribute__'
In file included from /usr/include/c++/10/set:61,
                 from holiday.cpp:23:
/usr/include/c++/10/bits/stl_set.h:64:14: error: expected ';' before '__attribute__'
   64 | namespace std _GLIBCXX_VISIBILITY(default)
      |              ^
      |              ;
/usr/include/c++/10/bits/stl_set.h:65:1: error: expected primary-expression before '{' token
   65 | {
      | ^
In file included from /usr/include/c++/10/utility:68,
                 from /usr/include/c++/10/algorithm:60,
                 from holiday.cpp:2:
/usr/include/c++/10/bits/stl_multiset.h:64:15: error: expected '=' before '__attribute__'
   64 | namespace std _GLIBCXX_VISIBILITY(default)
      |               ^~~~~~~~~~~~~~~~~~~
/usr/include/c++/10/bits/stl_multiset.h:64:15: error: expected identifier before '__attribute__'
In file included from /usr/include/c++/10/set:62,
                 from holiday.cpp:23:
/usr/include/c++/10/bits/stl_multiset.h:64:14: error: expected ';' before '__attribute__'
   64 | namespace std _GLIBCXX_VISIBILITY(default)
      |              ^
      |              ;
/usr/include/c++/10/bits/stl_multiset.h:65:1: error: expected primary-expression before '{' token
   65 | {
      | ^
In file included from /usr/include/c++/10/utility:68,
                 from /usr/include/c++/10/algorithm:60,
                 from holiday.cpp:2:
/usr/include/c++/10/set:71:15: error: expected '=' before '__attribute__'
   71 | namespace std _GLIBCXX_VISIBILITY(default)
      |               ^~~~~~~~~~~~~~~~~~~
/usr/include/c++/10/set:71:15: error: expected identifier before '__attribute__'
In file included from holiday.cpp:23:
/usr/include/c++/10/set:71:14: error: expected ';' before '__attribute__'
   71 | namespace std _GLIBCXX_VISIBILITY(default)
      |              ^
      |              ;
/usr/include/c++/10/set:72:1: error: expected primary-expression before '{' token
   72 | {
      | ^
holiday.cpp:32:1: error: 'multiset' was not declared in this scope
   32 | multiset<ll>st;
      | ^~~~~~~~
holiday.cpp:24:1: note: 'std::multiset' is defined in header '<set>'; did you forget to '#include <set>'?
   23 | #include<set>
  +++ |+#include <set>
   24 | 
holiday.cpp:32:12: error: expected primary-expression before '>' token
   32 | multiset<ll>st;
      |            ^
holiday.cpp:32:13: error: 'st' was not declared in this scope; did you mean 'std'?
   32 | multiset<ll>st;
      |             ^~
      |             std
holiday.cpp:34:65: error: a function-definition is not allowed here before '{' token
   34 | ll findMaxAttraction(int n, int start, int d, int attraction[]) {
      |                                                                 ^
holiday.cpp:29:11: warning: unused variable 'D' [-Wunused-variable]
   29 | const int D = 2*N + N/2;
      |           ^
holiday.cpp:31:4: warning: unused variable 'sum' [-Wunused-variable]
   31 | ll sum = 0;
      |    ^~~