제출 #584946

#제출 시각아이디문제언어결과실행 시간메모리
584946rxlfd314벽 (IOI14_wall)C++17
0 / 100
14 ms31612 KiB
// Made by Ron Xue #include <bits/stdc++.h> #include "wall.h" using namespace std; constexpr int mxn = 2e6 + 5, inf = 0x3f3f3f3f; int n, _1[mxn * 4], _2[mxn * 4]; void apply(int i, int v1, int v2) { _1[i] = max(v1, min(_1[i], v2)); _2[i] = min(v2, max(_1[i], v1)); } void push(int i) { apply(2 * i, _1[i], _2[i]); apply(2 * i + 1, _1[i], _2[i]); _1[i] = inf; _2[i] = 0; } void upd(int ql, int qr, int v1, int v2, int i = 1, int tl = 0, int tr = n - 1) { if (ql > tr || qr < tl) return; if (ql <= tl && tr <= qr) { apply(i, v1, v2); return; } push(i); int mid = tl + tr >> 1; upd(ql, qr, v1, v2, 2 * i, tl, mid); upd(ql, qr, v1, v2, 2 * i + 1, mid + 1, tr); } void fillans(int *ans, int i = 1, int tl = 0, int tr = n - 1) { if (tl == tr) { ans[tl] = min(_1[i], _2[i]); return; } push(i); int mid = tl + tr >> 1; fillans(ans, 2 * i, tl, mid); fillans(ans, 2 * i + 1, mid + 1, tr); } void buildWall(int len, int k, int *op, int *left, int *right, int *height, int *ans) { n = len; memset(_1, 0x3f, sizeof(_1)); for (int i = 0; i < k; i++) { upd(left[i], right[i], op[i] == 1 ? height[i] : inf, op[i] == 2 ? height[i] : 0); } fillans(ans); }

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

wall.cpp: In function 'void upd(int, int, int, int, int, int, int)':
wall.cpp:24:17: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
   24 |    int mid = tl + tr >> 1;
      |              ~~~^~~~
wall.cpp: In function 'void fillans(int*, int, int, int)':
wall.cpp:34:17: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
   34 |    int mid = tl + tr >> 1;
      |              ~~~^~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...