Submission #1148155

#TimeUsernameProblemLanguageResultExecution timeMemory
1148155TsaganaWall (IOI14_wall)C++20
Compilation error
0 ms0 KiB
#include "wall.h"
#include<bits/stdc++.h>

#define pq priority_queue
#define eb emplace_back
#define lb lower_bound
#define ub upper_bound
#define pb push_back
#define pp pop_back
#define F first
#define S second

using namespace std;

pair<int, int> seg[8000010];
 
void update(int id, int L, int R, int l, int r, int cur, bool op) {
  cur = max(cur, seg[i].F); cur = min(cur, seg[i].S);
  if (L > r || l > R) return;
  if (L >= l && r >= R) {if (!op) seg[i].F = cur; else seg[i].S = cur; return ;}
  int M = (L + R) / 2, x = 2 * id, y = x + 1;
  update(x, L, M, l, r, cur, op);
  update(y, M + 1, R, l, r, cur, op);
}
 
void make(int id, int L, int R, int cur, int *ans){
  cur = max(cur, seg[i].F); cur = min(cur, seg[i].S);
  if (l == r) {ans[l] = cur; return ;}
  int M = (L + R) / 2, x = 2 * id, y = x + 1;
  make(x, L, M, cur, ans);
  make(y, M + 1, R cur, ans);
}
 
void buildWall(int n, int k, int op[], int l[], int r[], int h[], int ans[]){
  for (int i = 1; i <= 4 * n; i++) seg[i] = {0, INT_MAX};
  for (int i = k - 1; i >= 0; i--) update(l[i], r[i], 1, 0, n - 1, h[i], op[i] - 1);
  make(0, n - 1, 1, 0, ans);
  return ;
}

Compilation message (stderr)

wall.cpp: In function 'void update(int, int, int, int, int, int, bool)':
wall.cpp:18:22: error: 'i' was not declared in this scope; did you mean 'id'?
   18 |   cur = max(cur, seg[i].F); cur = min(cur, seg[i].S);
      |                      ^
      |                      id
wall.cpp: In function 'void make(int, int, int, int, int*)':
wall.cpp:27:22: error: 'i' was not declared in this scope; did you mean 'id'?
   27 |   cur = max(cur, seg[i].F); cur = min(cur, seg[i].S);
      |                      ^
      |                      id
wall.cpp:28:7: error: 'l' was not declared in this scope
   28 |   if (l == r) {ans[l] = cur; return ;}
      |       ^
wall.cpp:28:12: error: 'r' was not declared in this scope
   28 |   if (l == r) {ans[l] = cur; return ;}
      |            ^
wall.cpp:31:19: error: expected ')' before 'cur'
   31 |   make(y, M + 1, R cur, ans);
      |       ~           ^~~~
      |                   )
wall.cpp:31:25: error: invalid conversion from 'int*' to 'int' [-fpermissive]
   31 |   make(y, M + 1, R cur, ans);
      |                         ^~~
      |                         |
      |                         int*
wall.cpp:31:7: error: too few arguments to function 'void make(int, int, int, int, int*)'
   31 |   make(y, M + 1, R cur, ans);
      |   ~~~~^~~~~~~~~~~~~~~~~~~~~~
wall.cpp:26:6: note: declared here
   26 | void make(int id, int L, int R, int cur, int *ans){
      |      ^~~~