제출 #155890

#제출 시각아이디문제언어결과실행 시간메모리
155890jhnah917벽 (IOI14_wall)C++14
100 / 100
1405 ms102460 KiB
#include "wall.h" #include <bits/stdc++.h> #define x first #define y second using namespace std; typedef long long ll; typedef pair<ll, ll> p; //lower bound, upper bound int *ans; p tree[1 << 22]; void push(int node, int op, ll v){ if(op == 1){ tree[node].x = max(tree[node].x, v); tree[node].y = max(tree[node].y, v); }else{ tree[node].x = min(tree[node].x, v); tree[node].y = min(tree[node].y, v); } } void update(int node, int s, int e, int l, int r, int op, ll v){ if(r < s || e < l) return; if(l <= s && e <= r){ push(node, op, v); ans[l] = tree[node].x; return; } int m = s + e >> 1; push(node*2, 1, tree[node].x); push(node*2, 2, tree[node].y); push(node*2+1, 1, tree[node].x); push(node*2+1, 2, tree[node].y); tree[node].x = 0, tree[node].y = 1e9; update(node*2, s, m, l, r, op, v); update(node*2+1, m+1, e, l, r, op, v); } void buildWall(int n, int k, int op[], int lf[], int rf[], int h[], int res[]){ ans = res; for(int i=0; i<k; i++){ update(1, 0, n-1, lf[i], rf[i], op[i], h[i]); } for(int i=0; i<n; i++){ update(1, 0, n-1, i, i, 1, 0); } }

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

wall.cpp: In function 'void update(int, int, int, int, int, int, ll)':
wall.cpp:30:12: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
  int m = s + e >> 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...