답안 #879252

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
879252 2023-11-27T04:27:23 Z marcid 벽 (IOI14_wall) C++17
컴파일 오류
0 ms 0 KB
#include "wall.h"
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define vb vector<bool>
#define vi vector<int>
#define ii pair<int,int>
#define iii tuple<int,int,int>
#define vii vector<ii>
#define viii vector<iii>
#define pb push_back
#define eb emplace_back
#define mod 1000000007
const int maxn = 5e6;
ii tree[(maxn<<2)+2];

void push(int v) {
	tree[v<<1].first=min(max(tree[v<<1].first,tree[v].first),tree[v].second);
	tree[v<<1|1].first=min(max(tree[v<<1|1].first,tree[v].first),tree[v].second);
	tree[v<<1].second=min(max(tree[v].first,tree[v<<1].second),tree[v].second);
	tree[v<<1|1].second=min(max(tree[v].first,tree[v<<1|1].second),tree[v].second);
}

void update(int t, int l, int r, int x, int v, int tl, int tr) {
	if (tl > r || l > tr) return;
	if (l <= tl && tr <= r) {
		if (t-1) {
			tree[v].first=min(tree[v].first,x);
			tree[v].second=min(tree[v].second,x);
		} else {
			tree[v].first=max(tree[v].first, x);
			tree[v].second=max(tree[v].second,x);
		}
	} 
	push(v);
	int mid = tl + tr >> 1;
	update(t,l,r,x,v*2,tl,mid); update(t,l,r,x,v*2+1,mid+1,tr);
	tree[v].first=min(tree[v<<1].first,tree[v<<1|1].first);
	tree[v].second=max(tree[v<<1].second,tree[v<<1|1].second);
}
vi fin(maxn);
void build(int v, int tl, int tr) {
	if (tl==tr) {
		fin[tl]=tree[v].first;
		return;
	}
	push(v);
	int mid = tl + tr >> 1;
	build(v*2,tl,mid); build(v*2+1,mid+1,tr);
}

void buildWaint(int n, int k, int op[], int left[], int right[], int height[], int finalHeight[]) {
	for (int i = 0; i < k; i++) {
		update(op[i],left[i],right[i],height[i],1,0,maxn);
	} build(1,0,maxn); for (int i = 0; i < n; i++) finalHeight[i]=fin[i];
}

Compilation message

wall.cpp: In function 'void update(long long int, long long int, long long int, long long int, long long int, long long int, long long int)':
wall.cpp:36:15: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
   36 |  int mid = tl + tr >> 1;
      |            ~~~^~~~
wall.cpp: In function 'void build(long long int, long long int, long long int)':
wall.cpp:48:15: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
   48 |  int mid = tl + tr >> 1;
      |            ~~~^~~~
/usr/bin/ld: /tmp/ccbTBMcs.o: in function `main':
grader.cpp:(.text.startup+0x133): undefined reference to `buildWall(int, int, int*, int*, int*, int*, int*)'
collect2: error: ld returned 1 exit status