Submission #321841

#TimeUsernameProblemLanguageResultExecution timeMemory
321841PetyJelly Flavours (IOI20_jelly)C++14
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> include <"jelly.h"> using namespace std; int n, m, dp[1002][1002], dp2[1002][1002], mn[1002]; struct meh { int a, b, i; } obj[1002]; bool cmp (meh a, meh b) { return a.a < b.a; } int find_maximum_unique(int x, int y, vector<int> a, vector<int> b) { int n = a.size(); int ans = 0; for (int i = 0; i < n; i++) obj[i + 1] = {a[i], b[i], i}; sort(obj + 1, obj + n + 1, cmp); for (int i = 1; i <= n; i++) { mn[i] = 2e9; for (int j = 0; j <= x;j++) { dp[i][j] = dp[i - 1][j] + obj[i].b; if (j >= obj[i].a) dp[i][j] = min(dp[i][j], dp[i - 1][j - obj[i].a]); mn[i] = min(mn[i], dp[i][j]); } } for (int i = n; i >= 1; i--) for (int j = obj[i].b; j <= y; j++) dp2[i][j] = min(dp2[i + 1][j], dp2[i][j - obj[i].b] + 1); for (int i = 0; i <= n; i++) { int cst = y - mn[i]; if (cst > 0) ans = max(ans, i + dp2[i + 1][cst]); } return ans; }

Compilation message (stderr)

jelly.cpp:2:1: error: 'include' does not name a type
    2 | include <"jelly.h">
      | ^~~~~~~
jelly.cpp:16:39: error: 'vector' has not been declared
   16 | int find_maximum_unique(int x, int y, vector<int> a, vector<int> b) {
      |                                       ^~~~~~
jelly.cpp:16:45: error: expected ',' or '...' before '<' token
   16 | int find_maximum_unique(int x, int y, vector<int> a, vector<int> b) {
      |                                             ^
jelly.cpp: In function 'int find_maximum_unique(int, int, int)':
jelly.cpp:17:11: error: 'a' was not declared in this scope
   17 |   int n = a.size();
      |           ^
jelly.cpp:20:25: error: 'b' was not declared in this scope
   20 |     obj[i + 1] = {a[i], b[i], i};
      |                         ^
jelly.cpp:20:32: error: no match for 'operator=' (operand types are 'meh' and '<brace-enclosed initializer list>')
   20 |     obj[i + 1] = {a[i], b[i], i};
      |                                ^
jelly.cpp:8:8: note: candidate: 'constexpr meh& meh::operator=(const meh&)'
    8 | struct meh {
      |        ^~~
jelly.cpp:8:8: note:   no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'const meh&'
jelly.cpp:8:8: note: candidate: 'constexpr meh& meh::operator=(meh&&)'
jelly.cpp:8:8: note:   no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'meh&&'
jelly.cpp:21:3: error: 'sort' was not declared in this scope; did you mean 'std::sort'?
   21 |   sort(obj + 1, obj + n + 1, cmp);
      |   ^~~~
      |   std::sort
In file included from /usr/include/c++/9/algorithm:62,
                 from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:65,
                 from jelly.cpp:1:
/usr/include/c++/9/bits/stl_algo.h:4887:5: note: 'std::sort' declared here
 4887 |     sort(_RandomAccessIterator __first, _RandomAccessIterator __last,
      |     ^~~~
jelly.cpp:27:20: error: 'min' was not declared in this scope; did you mean 'std::min'?
   27 |         dp[i][j] = min(dp[i][j], dp[i - 1][j - obj[i].a]);
      |                    ^~~
      |                    std::min
In file included from /usr/include/c++/9/algorithm:62,
                 from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:65,
                 from jelly.cpp:1:
/usr/include/c++/9/bits/stl_algo.h:3450:5: note: 'std::min' declared here
 3450 |     min(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
jelly.cpp:28:15: error: 'min' was not declared in this scope; did you mean 'std::min'?
   28 |       mn[i] = min(mn[i], dp[i][j]);
      |               ^~~
      |               std::min
In file included from /usr/include/c++/9/algorithm:62,
                 from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:65,
                 from jelly.cpp:1:
/usr/include/c++/9/bits/stl_algo.h:3450:5: note: 'std::min' declared here
 3450 |     min(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
jelly.cpp:33:18: error: 'min' was not declared in this scope; did you mean 'std::min'?
   33 |      dp2[i][j] = min(dp2[i + 1][j], dp2[i][j - obj[i].b] + 1);
      |                  ^~~
      |                  std::min
In file included from /usr/include/c++/9/algorithm:62,
                 from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:65,
                 from jelly.cpp:1:
/usr/include/c++/9/bits/stl_algo.h:3450:5: note: 'std::min' declared here
 3450 |     min(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
jelly.cpp:37:13: error: 'max' was not declared in this scope; did you mean 'std::max'?
   37 |       ans = max(ans, i + dp2[i + 1][cst]);
      |             ^~~
      |             std::max
In file included from /usr/include/c++/9/algorithm:62,
                 from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:65,
                 from jelly.cpp:1:
/usr/include/c++/9/bits/stl_algo.h:3462:5: note: 'std::max' declared here
 3462 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~