Submission #477718

#TimeUsernameProblemLanguageResultExecution timeMemory
477718Zhora_004쌀 창고 (IOI11_ricehub)C++17
Compilation error
0 ms0 KiB
#include "ricehub.h" 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:5:2: error: 'multiset' was not declared in this scope
    5 |  multiset<int> tmp;
      |  ^~~~~~~~
ricehub.cpp:5:11: error: expected primary-expression before 'int'
    5 |  multiset<int> tmp;
      |           ^~~
ricehub.cpp:6:22: error: 'n' was not declared in this scope
    6 |  for (int i = 0; i < n; i++) tmp.insert(x[i]);
      |                      ^
ricehub.cpp:6:30: error: 'tmp' was not declared in this scope
    6 |  for (int i = 0; i < n; i++) tmp.insert(x[i]);
      |                              ^~~
ricehub.cpp:6:41: error: 'x' was not declared in this scope
    6 |  for (int i = 0; i < n; i++) tmp.insert(x[i]);
      |                                         ^
ricehub.cpp:8:23: error: 'l' was not declared in this scope
    8 |  for (int i = 1; i <= l; i++)
      |                       ^
ricehub.cpp:11:12: error: expected primary-expression before 'int'
   11 |   multiset<int> ms = tmp;
      |            ^~~
ricehub.cpp:12:17: error: 'tmp_b' was not declared in this scope
   12 |   long long b = tmp_b;
      |                 ^~~~~
ricehub.cpp:15:15: error: 'ms' was not declared in this scope; did you mean 'mx'?
   15 |    auto it1 = ms.lower_bound(i);
      |               ^~
      |               mx
ricehub.cpp:32:9: error: 'min' was not declared in this scope
   32 |     if (min(num1 - i, i - num2) <= b)
      |         ^~~
ricehub.cpp:40:8: error: 'max' was not declared in this scope; did you mean 'mx'?
   40 |   mx = max(mx, ans);
      |        ^~~
      |        mx