Submission #875285

# Submission time Handle Problem Language Result Execution time Memory
875285 2023-11-19T01:38:17 Z boyliguanhan Wall (IOI14_wall) C++17
Compilation error
0 ms 0 KB
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<vector>
#define pii pair<int,int>
#define mk make_pair
#define ft first
#define se second
#define pb push_back
#define db double
#define ll long long
#define ull unsigned long long
#define INF 0x3f3f3f3f
#define inf 1e18
using namespace std;
int read(){
    int x=0,f=1;char ch=getchar();
    while(ch<'0'||ch>'9') {if(ch=='-') f=-1;ch=getchar();}
    while(ch>='0'&&ch<='9') {x=(x<<3)+(x<<1)+(ch^48);ch=getchar();}
    return x*f;
}
int stk[40],tp;
void write(int x,char c='\0'){
    if(x<0) putchar('-'),x=-x;
    do{
        stk[++tp]=x%10,x/=10;
    }while(x);
    while(tp) putchar(stk[tp--]^48);
    if(c) putchar(c);
}
#define M 2000005
int n,Q;
struct node{
	int tmx,tmn;
}d[M<<2];
void pushdown(int p){
	if(d[p].tmx){
		d[p<<1].tmx=max(d[p<<1].tmx,d[p].tmx);
		d[p<<1].tmn=max(d[p<<1].tmn,d[p].tmx);
		d[p<<1|1].tmx=max(d[p<<1|1].tmx,d[p].tmx);
		d[p<<1|1].tmn=max(d[p<<1|1].tmn,d[p].tmx);
		d[p].tmx=0;
	}
	if(d[p].tmn!=INF){
		d[p<<1].tmx=min(d[p<<1].tmx,d[p].tmn);
		d[p<<1].tmn=min(d[p<<1].tmn,d[p].tmn);
		d[p<<1|1].tmx=min(d[p<<1|1].tmx,d[p].tmn);
		d[p<<1|1].tmn=min(d[p<<1|1].tmn,d[p].tmn);
		d[p].tmn=INF; 
	} 
}
void chkmx(int l,int r,int ql,int qr,int x,int p){
	if(ql>=l&&qr<=r){
		d[p].tmx=max(d[p].tmx,x);
		d[p].tmn=max(d[p].tmn,x);
		return;
	}
	pushdown(p);
	int mid=(ql+qr)>>1;
	if(r<=mid) chkmx(l,r,ql,mid,x,p<<1);
	else if(l>mid) chkmx(l,r,mid+1,qr,x,p<<1|1);
	else chkmx(l,r,ql,mid,x,p<<1),chkmx(l,r,mid+1,qr,x,p<<1|1);
}
void chkmn(int l,int r,int ql,int qr,int x,int p){
	if(ql>=l&&qr<=r){
		d[p].tmx=min(d[p].tmx,x);
		d[p].tmn=min(d[p].tmn,x);
		return;
	}
	pushdown(p);
	int mid=(ql+qr)>>1;
	if(r<=mid) chkmn(l,r,ql,mid,x,p<<1);
	else if(l>mid) chkmn(l,r,mid+1,qr,x,p<<1|1);
	else chkmn(l,r,ql,mid,x,p<<1),chkmn(l,r,mid+1,qr,x,p<<1|1);
}
void print(int ql,int qr,int p){
	if(ql==qr){
		write(d[p].tmx,'\n');
		return; 
	}
	pushdown(p);
	int mid=(ql+qr)>>1;
	print(ql,mid,p<<1);
	print(mid+1,qr,p<<1|1);
}
int main(){
	n=read(),Q=read();
	for(int i=0;i<(n<<2);i++) d[i].tmn=INF;
	while(Q--){
		int opt=read(),l=read()+1,r=read()+1,x=read();
		if(opt==1) chkmx(l,r,1,n,x,1);
		else chkmn(l,r,1,n,x,1);
	}
	print(1,n,1);
	return 0;
}

Compilation message

/usr/bin/ld: /tmp/ccOFzE6G.o: in function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'; /tmp/cc95IlEK.o:wall.cpp:(.text.startup+0x0): first defined here
/usr/bin/ld: /tmp/ccOFzE6G.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