제출 #660139

#제출 시각아이디문제언어결과실행 시간메모리
660139Trisanu_Das벽 (IOI14_wall)C++17
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> #include "wall.h" #define N 2000001 using namespace std; int seg[4 * N][2]; // 2 parts for add and remove ops void update(int s, int e, int l, int r, int i, int cur, bool op){ cur = max(cur, seg[i][0]); cur = min(cur, seg[i][1]); if(l > s || e < r) return; if(l >= s || e <= r){ if(!b) seg[i][0] = cur; else seg[i][1] = cur; return; } update(s, e, l, (l + r) / 2, 2 * i, cur, op); update(s, e, (l + r) / 2 + 1, e, 2 * i + 1, cur, op); } void build(int l, int r, int i, int cur, int* ans){ cur = max(cur, seg[i][0]); cur = min(cur, seg[i][1]); if(s == e) ans = cur; build(l, (l + r) / 2, 2 * i, cur, int* ans); build((l + r) / 2 + 1, e, 2 * i + 1, cur, int* ans); } void buildWall(int n, int k, int* op, int* l, int* r, int* h, int* ans){ for(int i = 0; i < 4 * n; i++){seg[i][0] = 0; seg[i][1] = INT_MAX;} for(int i = k - 1; i > -1; i--) update(l[i], r[i], 0, n - 1, 1, h[i], op[i] - 1); build(0, n - 1, 1, 0, ans); }

컴파일 시 표준 에러 (stderr) 메시지

wall.cpp: In function 'void update(int, int, int, int, int, int, bool)':
wall.cpp:12:9: error: 'b' was not declared in this scope
   12 |     if(!b) seg[i][0] = cur; else seg[i][1] = cur;
      |         ^
wall.cpp: In function 'void build(int, int, int, int, int*)':
wall.cpp:20:6: error: 's' was not declared in this scope
   20 |   if(s == e) ans = cur;
      |      ^
wall.cpp:20:11: error: 'e' was not declared in this scope
   20 |   if(s == e) ans = cur;
      |           ^
wall.cpp:20:20: error: invalid conversion from 'int' to 'int*' [-fpermissive]
   20 |   if(s == e) ans = cur;
      |                    ^~~
      |                    |
      |                    int
wall.cpp:21:37: error: expected primary-expression before 'int'
   21 |   build(l, (l + r) / 2, 2 * i, cur, int* ans);
      |                                     ^~~
wall.cpp:22:26: error: 'e' was not declared in this scope
   22 |   build((l + r) / 2 + 1, e, 2 * i + 1, cur, int* ans);
      |                          ^
wall.cpp:22:45: error: expected primary-expression before 'int'
   22 |   build((l + r) / 2 + 1, e, 2 * i + 1, cur, int* ans);
      |                                             ^~~