Submission #1157285

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
11572852025-02-25 13:56:02coolsentenceidontrememberElection (BOI18_election)C++20
Compilation error
0 ms0 KiB
void upd(const int &id, const int &l, const int &r, const int &p,
const int &v) {
// std::cout << l << r << '\n';
if (l == r) {
st[id] = {v, v};
return;
}
int m = (l + r) >> 1;
if (p <= m)
upd(id << 1, l, m, p, v);
else
upd(id << 1 | 1, m + 1, r, p, v);
st[id] = combine(st[id << 1], st[id << 1 | 1]);
return;
}
std::pair<int, int> get(const int &id, const int &l, const int &r, const int &u,
const int &v) {
if (r < u || l > v)
return std::pair<int, int>(0, 0);
if (l >= u && r <= v)
return st[id];
int m = (l + r) >> 1;
return combine(get(id << 1, l, m, u, v), get(id << 1 | 1, m + 1, r, u, v));
}
int main() {
setIO();
int n;
std::cin >> n;
st = std::vector<std::pair<int, int>>((n << 2) + 1);
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Compilation message (stderr)

election.cpp: In function 'void upd(const int&, const int&, const int&, const int&, const int&)':
election.cpp:5:5: error: 'st' was not declared in this scope; did you mean 'std'?
    5 |     st[id] = {v, v};
      |     ^~
      |     std
election.cpp:13:3: error: 'st' was not declared in this scope; did you mean 'std'?
   13 |   st[id] = combine(st[id << 1], st[id << 1 | 1]);
      |   ^~
      |   std
election.cpp:13:12: error: 'combine' was not declared in this scope
   13 |   st[id] = combine(st[id << 1], st[id << 1 | 1]);
      |            ^~~~~~~
election.cpp: At global scope:
election.cpp:17:6: error: 'pair' in namespace 'std' does not name a template type
   17 | std::pair<int, int> get(const int &id, const int &l, const int &r, const int &u,
      |      ^~~~
election.cpp:1:1: note: 'std::pair' is defined in header '<utility>'; did you forget to '#include <utility>'?
  +++ |+#include <utility>
    1 | void upd(const int &id, const int &l, const int &r, const int &p,
election.cpp: In function 'int main()':
election.cpp:27:3: error: 'setIO' was not declared in this scope
   27 |   setIO();
      |   ^~~~~
election.cpp:29:8: error: 'cin' is not a member of 'std'
   29 |   std::cin >> n;
      |        ^~~
election.cpp:1:1: note: 'std::cin' is defined in header '<iostream>'; did you forget to '#include <iostream>'?
  +++ |+#include <iostream>
    1 | void upd(const int &id, const int &l, const int &r, const int &p,
election.cpp:30:3: error: 'st' was not declared in this scope; did you mean 'std'?
   30 |   st = std::vector<std::pair<int, int>>((n << 2) + 1);
      |   ^~
      |   std
election.cpp:30:13: error: 'vector' is not a member of 'std'
   30 |   st = std::vector<std::pair<int, int>>((n << 2) + 1);
      |             ^~~~~~
election.cpp:1:1: note: 'std::vector' is defined in header '<vector>'; did you forget to '#include <vector>'?
  +++ |+#include <vector>
    1 | void upd(const int &id, const int &l, const int &r, const int &p,
election.cpp:30:25: error: 'pair' is not a member of 'std'
   30 |   st = std::vector<std::pair<int, int>>((n << 2) + 1);
      |                         ^~~~
election.cpp:30:25: note: 'std::pair' is defined in header '<utility>'; did you forget to '#include <utility>'?
election.cpp:30:30: error: expected primary-expression before 'int'
   30 |   st = std::vector<std::pair<int, int>>((n << 2) + 1);
      |                              ^~~
election.cpp:33:10: error: 'cin' is not a member of 'std'
   33 |     std::cin >> c;
      |          ^~~
election.cpp:33:10: note: 'std::cin' is defined in header '<iostream>'; did you forget to '#include <iostream>'?
election.cpp:34:5: error: 'vote' was not declared in this scope
   34 |     vote.push_back((c == 'C') ? 1 : -1);
      |     ^~~~
election.cpp:37:8: error: 'cin' is not a member of 'std'
   37 |   std::cin >> q;
      |        ^~~
election.cpp:37:8: note: 'std::cin' is defined in header '<iostream>'; did you forget to '#include <iostream>'?
election.cpp:40:10: error: 'cin' is not a member of 'std'
   40 |     std::cin >> l >> r;
      |          ^~~
election.cpp:40:10: note: 'std::cin' is defined in header '<iostream>'; did you forget to '#include <iostream>'?
election.cpp:41:5: error: 'query' was not declared in this scope
   41 |     query.push_back({--l, --r, i - 1});
      |     ^~~~~
election.cpp:43:8: error: 'sort' is not a member of 'std'
   43 |   std::sort(query.begin(), query.end(),
      |        ^~~~
election.cpp:43:13: error: 'query' was not declared in this scope
   43 |   std::sort(query.begin(), query.end(),
      |             ^~~~~
election.cpp:44:28: error: 'array' in namespace 'std' does not name a template type
   44 |             [&](const std::array<int, 3> &a, const std::array<int, 3> &b) {
      |                            ^~~~~
election.cpp:1:1: note: 'std::array' is defined in header '<array>'; did you forget to '#include <array>'?
  +++ |+#include <array>
    1 | void upd(const int &id, const int &l, const int &r, const int &p,
election.cpp: In lambda function:
election.cpp:46:15: error: expected '{' before ';' token
   46 |             });
      |               ^
election.cpp: In function 'int main()':
election.cpp:46:15: error: expected ')' before ';' token
   46 |             });
      |               ^
      |               )
election.cpp:43:12: note: to match this '('
   43 |   std::sort(query.begin(), query.end(),
      |            ^
election.cpp:47:8: error: 'vector' is not a member of 'std'
   47 |   std::vector<int> ans(q);
      |        ^~~~~~
election.cpp:47:8: note: 'std::vector' is defined in header '<vector>'; did you forget to '#include <vector>'?
election.cpp:47:15: error: expected primary-expression before 'int'
   47 |   std::vector<int> ans(q);
      |               ^~~
election.cpp:49:8: error: 'vector' is not a member of 'std'
   49 |   std::vector<int> cur;
      |        ^~~~~~
election.cpp:49:8: note: 'std::vector' is defined in header '<vector>'; did you forget to '#include <vector>'?
election.cpp:49:15: error: expected primary-expression before 'int'
   49 |   std::vector<int> cur;
      |               ^~~
election.cpp:50:19: error: 'array' in namespace 'std' does not name a template type
   50 |   for (const std::array<int, 3> &a : query) {
      |                   ^~~~~
election.cpp:50:14: note: 'std::array' is defined in header '<array>'; did you forget to '#include <array>'?
   50 |   for (const std::array<int, 3> &a : query) {
      |              ^~~
election.cpp:67:4: error: expected ';' before 'for'
   67 |   }
      |    ^
      |    ;
   68 |   for (int i = 0; i < q; i++) {
      |   ~~~
election.cpp:68:3: error: expected primary-expression before 'for'
   68 |   for (int i = 0; i < q; i++) {
      |   ^~~
election.cpp:67:4: error: expected ';' before 'for'
   67 |   }
      |    ^
      |    ;
   68 |   for (int i = 0; i < q; i++) {
      |   ~~~
election.cpp:68:3: error: expected primary-expression before 'for'
   68 |   for (int i = 0; i < q; i++) {
      |   ^~~
election.cpp:67:4: error: expected ')' before 'for'
   67 |   }
      |    ^
      |    )
   68 |   for (int i = 0; i < q; i++) {
      |   ~~~
election.cpp:50:7: note: to match this '('
   50 |   for (const std::array<int, 3> &a : query) {
      |       ^
election.cpp:69:10: error: 'cout' is not a member of 'std'
   69 |     std::cout << ans[i] << '\n';
      |          ^~~~
election.cpp:69:10: note: 'std::cout' is defined in header '<iostream>'; did you forget to '#include <iostream>'?
election.cpp:69:18: error: 'ans' was not declared in this scope
   69 |     std::cout << ans[i] << '\n';
      |                  ^~~