Submission #477720

#TimeUsernameProblemLanguageResultExecution timeMemory
477720Zhora_004Rice Hub (IOI11_ricehub)C++17
Compilation error
0 ms0 KiB
#include "ricehub.h" #include <iostream> #include <cmath> #include <algorithm> #include <vector> #include <set> #include <unordered_set> #include <queue> #include <deque> #include <string> #include <sstream> #include <iomanip> #include <map> #include <unordered_map> #include <stack> #include <cstdio> #include <climits> #include <tuple> #include <ctime> #include <cstring> #include <numeric> #include <functional> #include <chrono> #include <cassert> #include <bitset> int besthub(int R, int L, int X[], long long B) { multiset<int> tmp; for (int i = 0; i < n; i++) tmp.insert(x[i]); int mx = 0; for (int i = 1; i <= l; i++) { int ans = 0; multiset<int> ms = tmp; long long b = tmp_b; while (b) { auto it1 = ms.lower_bound(i); int num1 = -1, num2 = -1; if (it1 != ms.end()) num1 = *it1; if (it1 != ms.begin()) it1--, num2 = *it1; if (num1 == -1 && num2 == -1) continue; if (num1 == -1) { if (i - num2 <= b) b -= i - num2, ans++, ms.erase(ms.find(num2)); else break; } else if (num2 == -1) { if (num1 - i <= b) b -= num1 - i, ans++, ms.erase(ms.find(num1)); else break; } else { if (min(num1 - i, i - num2) <= b) { if (num1 - i <= i - num2) b -= num1 - i, ans++, ms.erase(ms.find(num1)); else b -= i - num2, ans++, ms.erase(ms.find(num2)); } else break; } } mx = max(mx, ans); } return mx; }

Compilation message (stderr)

ricehub.cpp: In function 'int besthub(int, int, int*, long long int)':
ricehub.cpp:29:2: error: 'multiset' was not declared in this scope
   29 |  multiset<int> tmp;
      |  ^~~~~~~~
ricehub.cpp:29:2: note: suggested alternatives:
In file included from /usr/include/c++/10/set:61,
                 from ricehub.cpp:6:
/usr/include/c++/10/bits/stl_set.h:70:11: note:   'std::multiset'
   70 |     class multiset;
      |           ^~~~~~~~
In file included from ricehub.cpp:6:
/usr/include/c++/10/set:80:13: note:   'std::pmr::multiset'
   80 |       using multiset = std::multiset<_Key, _Cmp, polymorphic_allocator<_Key>>;
      |             ^~~~~~~~
ricehub.cpp:29:11: error: expected primary-expression before 'int'
   29 |  multiset<int> tmp;
      |           ^~~
ricehub.cpp:30:22: error: 'n' was not declared in this scope
   30 |  for (int i = 0; i < n; i++) tmp.insert(x[i]);
      |                      ^
ricehub.cpp:30:30: error: 'tmp' was not declared in this scope; did you mean 'tm'?
   30 |  for (int i = 0; i < n; i++) tmp.insert(x[i]);
      |                              ^~~
      |                              tm
ricehub.cpp:30:41: error: 'x' was not declared in this scope
   30 |  for (int i = 0; i < n; i++) tmp.insert(x[i]);
      |                                         ^
ricehub.cpp:32:23: error: 'l' was not declared in this scope
   32 |  for (int i = 1; i <= l; i++)
      |                       ^
ricehub.cpp:35:12: error: expected primary-expression before 'int'
   35 |   multiset<int> ms = tmp;
      |            ^~~
ricehub.cpp:36:17: error: 'tmp_b' was not declared in this scope
   36 |   long long b = tmp_b;
      |                 ^~~~~
ricehub.cpp:39:15: error: 'ms' was not declared in this scope; did you mean 'mx'?
   39 |    auto it1 = ms.lower_bound(i);
      |               ^~
      |               mx
ricehub.cpp:56:9: error: 'min' was not declared in this scope; did you mean 'std::min'?
   56 |     if (min(num1 - i, i - num2) <= b)
      |         ^~~
      |         std::min
In file included from /usr/include/c++/10/algorithm:62,
                 from ricehub.cpp:4:
/usr/include/c++/10/bits/stl_algo.h:3474:5: note: 'std::min' declared here
 3474 |     min(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
ricehub.cpp:64:8: error: 'max' was not declared in this scope; did you mean 'std::max'?
   64 |   mx = max(mx, ans);
      |        ^~~
      |        std::max
In file included from /usr/include/c++/10/algorithm:62,
                 from ricehub.cpp:4:
/usr/include/c++/10/bits/stl_algo.h:3486:5: note: 'std::max' declared here
 3486 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~