Submission #466681

#TimeUsernameProblemLanguageResultExecution timeMemory
466681jli12345Wall (IOI14_wall)C++14
Compilation error
0 ms0 KiB
#include <wall.h> pair<int, int> st[8000100]; pair<int, int> combine(pair<int, int> orig, pair<int, int> upd){ if (upd.second > orig.first){ return {upd.second, upd.second}; } else if (upd.first < orig.second){ return {upd.first, upd.first}; } else { return {min(orig.first, upd.first), max(orig.second, upd.second)}; } } void pushdown(int node){ st[node*2] = combine(st[node*2], st[node]); st[node*2+1] = combine(st[node*2+1], st[node]); } void U(int node, int l, int r, int tl, int tr, pair<int, int> upd){ if (l >tr || r < tl) return; if (l >= tl && r <= tr){ st[node] = combine(st[node], upd); //cout << l << " " << r << " " << st[node].first << " " << st[node].second << "\n"; return; } pushdown(node); int mid = (l+r)/2; U(node*2, l, mid, tl, tr, upd); U(node*2+1, mid+1, r, tl, tr, upd); st[node].first = max(st[node*2].first, st[node*2+1].first); st[node].second = min(st[node*2].second, st[node*2+1].second); } int Q(int node, int l, int r, int ind){ if (l > ind || r < ind){ return 0; } if (l == r){ return st[node].first; } pushdown(node); int mid = (l+r)/2; st[node].first = max(st[node*2].first, st[node*2+1].first); st[node].second = min(st[node*2].second, st[node*2+1].second); return max(Q(node*2, l, mid, ind), Q(node*2+1, mid+1, r, ind)); } void buildWall(int n, int k, int op[], int left[], int right[], int height[], int finalHeight[]){ for (int i = 0; i < k; i++){ if (op[i] == 1){ U(1, 0, n-1, left[i], right[i], {0x3f3f3f3f, height[i]}); } else { U(1, 0, n-1, left[i], right[i], {height[i], 0}); } } for (int i = 0; i < n; i++){ finalHeight[i] = Q(1, 0, n-1, i); } }

Compilation message (stderr)

wall.cpp:3:1: error: 'pair' does not name a type
    3 | pair<int, int> st[8000100];
      | ^~~~
wall.cpp:5:1: error: 'pair' does not name a type
    5 | pair<int, int> combine(pair<int, int> orig, pair<int, int> upd){
      | ^~~~
wall.cpp: In function 'void pushdown(int)':
wall.cpp:16:5: error: 'st' was not declared in this scope; did you mean 'std'?
   16 |     st[node*2] = combine(st[node*2], st[node]);
      |     ^~
      |     std
wall.cpp:16:18: error: 'combine' was not declared in this scope
   16 |     st[node*2] = combine(st[node*2], st[node]);
      |                  ^~~~~~~
wall.cpp: At global scope:
wall.cpp:20:48: error: 'pair' has not been declared
   20 | void U(int node, int l, int r, int tl, int tr, pair<int, int> upd){
      |                                                ^~~~
wall.cpp:20:52: error: expected ',' or '...' before '<' token
   20 | void U(int node, int l, int r, int tl, int tr, pair<int, int> upd){
      |                                                    ^
wall.cpp: In function 'void U(int, int, int, int, int, int)':
wall.cpp:24:9: error: 'st' was not declared in this scope; did you mean 'std'?
   24 |         st[node] = combine(st[node], upd);
      |         ^~
      |         std
wall.cpp:24:38: error: 'upd' was not declared in this scope
   24 |         st[node] = combine(st[node], upd);
      |                                      ^~~
wall.cpp:24:20: error: 'combine' was not declared in this scope
   24 |         st[node] = combine(st[node], upd);
      |                    ^~~~~~~
wall.cpp:30:31: error: 'upd' was not declared in this scope
   30 |     U(node*2, l, mid, tl, tr, upd);
      |                               ^~~
wall.cpp:32:5: error: 'st' was not declared in this scope; did you mean 'std'?
   32 |     st[node].first = max(st[node*2].first, st[node*2+1].first);
      |     ^~
      |     std
wall.cpp:32:22: error: 'max' was not declared in this scope
   32 |     st[node].first = max(st[node*2].first, st[node*2+1].first);
      |                      ^~~
wall.cpp:33:23: error: 'min' was not declared in this scope; did you mean 'mid'?
   33 |     st[node].second = min(st[node*2].second, st[node*2+1].second);
      |                       ^~~
      |                       mid
wall.cpp: In function 'int Q(int, int, int, int)':
wall.cpp:41:16: error: 'st' was not declared in this scope; did you mean 'std'?
   41 |         return st[node].first;
      |                ^~
      |                std
wall.cpp:45:5: error: 'st' was not declared in this scope; did you mean 'std'?
   45 |     st[node].first = max(st[node*2].first, st[node*2+1].first);
      |     ^~
      |     std
wall.cpp:45:22: error: 'max' was not declared in this scope
   45 |     st[node].first = max(st[node*2].first, st[node*2+1].first);
      |                      ^~~
wall.cpp:46:23: error: 'min' was not declared in this scope; did you mean 'mid'?
   46 |     st[node].second = min(st[node*2].second, st[node*2+1].second);
      |                       ^~~
      |                       mid
wall.cpp: In function 'void buildWall(int, int, int*, int*, int*, int*, int*)':
wall.cpp:53:68: error: cannot convert '<brace-enclosed initializer list>' to 'int'
   53 |             U(1, 0, n-1, left[i], right[i], {0x3f3f3f3f, height[i]});
      |                                                                    ^
      |                                                                    |
      |                                                                    <brace-enclosed initializer list>
wall.cpp:20:48: note:   initializing argument 6 of 'void U(int, int, int, int, int, int)'
   20 | void U(int node, int l, int r, int tl, int tr, pair<int, int> upd){
      |                                                ^~~~
wall.cpp:55:59: error: cannot convert '<brace-enclosed initializer list>' to 'int'
   55 |             U(1, 0, n-1, left[i], right[i], {height[i], 0});
      |                                                           ^
      |                                                           |
      |                                                           <brace-enclosed initializer list>
wall.cpp:20:48: note:   initializing argument 6 of 'void U(int, int, int, int, int, int)'
   20 | void U(int node, int l, int r, int tl, int tr, pair<int, int> upd){
      |                                                ^~~~