Submission #73643

# Submission time Handle Problem Language Result Execution time Memory
73643 2018-08-28T16:14:00 Z TuGSGeReL Wall (IOI14_wall) C++14
61 / 100
1083 ms 251248 KB
#include "wall.h"
#include<bits/stdc++.h>
#define ll long long
#define mp make_pair
#define pub push_back
#define pob pop_back
#define ss second
#define ff first
#define ext exit(0)
using namespace std;
int o,a[2000001],lax[4000001],lam[4000001],fin[2000001];
void init(int node, int l , int r){
	lam[node]=1e9;
	lax[node]=0;
	if(l==r) return;
	int mid=(l+r)/2;
	init(node*2,l,mid);
	init(node*2+1,mid+1,r);
}
void mx(int node, int h){
	lax[node]=max(lax[node],h);
	lam[node]=max(lam[node],lax[node]);
}
void mn(int node, int h){
	lam[node]=min(lam[node],h);
	lax[node]=min(lax[node],lam[node]);
}
void push(int node){
	mx(node*2,lax[node]);
	mx(node*2+1,lax[node]);
	mn(node*2,lam[node]);
	mn(node*2+1,lam[node]);
	lax[node]=0;
	lam[node]=1e9;
}
void query(int node,int l , int r, int L , int R, int h, int o){
	if(l>R || r< L) return;
	if(l>=L && r<=R) {
		if(o==1)mx(node,h);
		else mn(node,h);
		return ;
	}
	push(node);
	int mid=(l+r)/2;
	query(node*2,l,mid,L,R,h,o);
	query(node*2+1,mid+1,r,L,R,h,o);
}
void f(int node, int l , int r){
	if(l==r){
		fin[l]=lax[node];
		return ;
	}
	push(node);
	int mid=(l+r)/2;
	f(node*2,l,mid);
	f(node*2+1,mid+1,r);
}
void buildWall(int n, int k, int op[], int left[], int right[], int height[], int finalHeight[]){
	init(1,0,n-1);
	for(int i=0;i<k;i++){
		query(1,0,n-1,left[i],right[i],height[i],op[i]);
	}
	f(1,0,n-1);
	for(int i=0;i<n;i++) finalHeight[i]=fin[i];
	return;
}
# Verdict Execution time Memory Grader output
1 Correct 3 ms 248 KB Output is correct
2 Correct 5 ms 612 KB Output is correct
3 Correct 4 ms 612 KB Output is correct
4 Correct 10 ms 1048 KB Output is correct
5 Correct 9 ms 1048 KB Output is correct
6 Correct 9 ms 1300 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 1300 KB Output is correct
2 Correct 263 ms 8740 KB Output is correct
3 Correct 254 ms 8740 KB Output is correct
4 Correct 752 ms 21544 KB Output is correct
5 Correct 448 ms 32068 KB Output is correct
6 Correct 376 ms 40672 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 40672 KB Output is correct
2 Correct 4 ms 40672 KB Output is correct
3 Correct 5 ms 40672 KB Output is correct
4 Correct 14 ms 40672 KB Output is correct
5 Correct 12 ms 40672 KB Output is correct
6 Correct 10 ms 40672 KB Output is correct
7 Correct 3 ms 40672 KB Output is correct
8 Correct 207 ms 43360 KB Output is correct
9 Correct 237 ms 43360 KB Output is correct
10 Correct 725 ms 59732 KB Output is correct
11 Correct 420 ms 70416 KB Output is correct
12 Correct 403 ms 79064 KB Output is correct
13 Correct 5 ms 79064 KB Output is correct
14 Correct 226 ms 81384 KB Output is correct
15 Correct 44 ms 81384 KB Output is correct
16 Correct 696 ms 94876 KB Output is correct
17 Correct 404 ms 103852 KB Output is correct
18 Correct 386 ms 112996 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 112996 KB Output is correct
2 Correct 4 ms 112996 KB Output is correct
3 Correct 6 ms 112996 KB Output is correct
4 Correct 9 ms 112996 KB Output is correct
5 Correct 12 ms 112996 KB Output is correct
6 Correct 8 ms 112996 KB Output is correct
7 Correct 2 ms 112996 KB Output is correct
8 Correct 286 ms 115780 KB Output is correct
9 Correct 272 ms 115780 KB Output is correct
10 Correct 681 ms 132312 KB Output is correct
11 Correct 441 ms 142944 KB Output is correct
12 Correct 410 ms 151536 KB Output is correct
13 Correct 3 ms 151536 KB Output is correct
14 Correct 201 ms 153832 KB Output is correct
15 Correct 54 ms 153832 KB Output is correct
16 Correct 741 ms 167448 KB Output is correct
17 Correct 421 ms 176364 KB Output is correct
18 Correct 393 ms 185376 KB Output is correct
19 Incorrect 1083 ms 251248 KB Output isn't correct
20 Halted 0 ms 0 KB -