Submission #43768

# Submission time Handle Problem Language Result Execution time Memory
43768 2018-03-23T04:17:12 Z faustaadp Wall (IOI14_wall) C++14
100 / 100
915 ms 137728 KB
#include "wall.h"
#include<bits/stdc++.h>
#define ll long long
using namespace std;
ll i,mi[8080808],ma[8080808],h[2020202];
void tum(ll aa,ll bb,ll cc)
{
	mi[aa]=min(mi[aa],bb);
	ma[aa]=max(min(ma[aa],bb),cc);
}
void upd(ll aa,ll bb,ll cc,ll dd,ll ee,ll ff,ll gg)
{
	if(aa==bb)
		h[aa]=ma[ee];
	else
	if(mi[ee]!=1e17||ma[ee]!=0)
	{
		tum(ee*2,mi[ee],ma[ee]);
		tum(ee*2+1,mi[ee],ma[ee]);
		mi[ee]=1e17;
		ma[ee]=0;		
	}
	if(cc!=-1&&(bb<cc||dd<aa))
		return ;
	else
	if(cc!=-1&&cc<=aa&&bb<=dd)
		tum(ee,ff,gg);
	else
	{
		if(aa==bb)	return ;
		upd(aa,(aa+bb)/2,cc,dd,ee*2,ff,gg);
		upd((aa+bb)/2+1,bb,cc,dd,ee*2+1,ff,gg);
	}
}
void buildWall(int n, int k, int op[], int left[], int right[], int height[], int finalHeight[]){
	for(i=1;i<=4*n;i++)
		mi[i]=1e17;
	for(i=0;i<k;i++)
		if(op[i]==1)
			upd(0,n-1,left[i],right[i],1,1e17,height[i]);
		else
			upd(0,n-1,left[i],right[i],1,height[i],0);
	upd(0,n-1,-1,-1,1,1e17,0);
	for(i=0;i<n;i++)
		finalHeight[i]=h[i];
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 248 KB Output is correct
2 Correct 3 ms 484 KB Output is correct
3 Correct 3 ms 532 KB Output is correct
4 Correct 9 ms 1372 KB Output is correct
5 Correct 7 ms 1372 KB Output is correct
6 Correct 7 ms 1444 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 1444 KB Output is correct
2 Correct 196 ms 8524 KB Output is correct
3 Correct 230 ms 8524 KB Output is correct
4 Correct 726 ms 15120 KB Output is correct
5 Correct 352 ms 15624 KB Output is correct
6 Correct 346 ms 15624 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 15624 KB Output is correct
2 Correct 4 ms 15624 KB Output is correct
3 Correct 3 ms 15624 KB Output is correct
4 Correct 9 ms 15624 KB Output is correct
5 Correct 7 ms 15624 KB Output is correct
6 Correct 7 ms 15624 KB Output is correct
7 Correct 1 ms 15624 KB Output is correct
8 Correct 181 ms 15624 KB Output is correct
9 Correct 229 ms 15624 KB Output is correct
10 Correct 754 ms 15624 KB Output is correct
11 Correct 337 ms 15624 KB Output is correct
12 Correct 354 ms 15624 KB Output is correct
13 Correct 2 ms 15624 KB Output is correct
14 Correct 197 ms 15624 KB Output is correct
15 Correct 38 ms 15624 KB Output is correct
16 Correct 724 ms 15624 KB Output is correct
17 Correct 381 ms 15624 KB Output is correct
18 Correct 316 ms 15624 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 15624 KB Output is correct
2 Correct 3 ms 15624 KB Output is correct
3 Correct 5 ms 15624 KB Output is correct
4 Correct 8 ms 15624 KB Output is correct
5 Correct 9 ms 15624 KB Output is correct
6 Correct 7 ms 15624 KB Output is correct
7 Correct 2 ms 15624 KB Output is correct
8 Correct 183 ms 15624 KB Output is correct
9 Correct 234 ms 15624 KB Output is correct
10 Correct 752 ms 15624 KB Output is correct
11 Correct 349 ms 15624 KB Output is correct
12 Correct 343 ms 15624 KB Output is correct
13 Correct 2 ms 15624 KB Output is correct
14 Correct 187 ms 15624 KB Output is correct
15 Correct 44 ms 15624 KB Output is correct
16 Correct 795 ms 15624 KB Output is correct
17 Correct 338 ms 15624 KB Output is correct
18 Correct 332 ms 15624 KB Output is correct
19 Correct 886 ms 137608 KB Output is correct
20 Correct 869 ms 137608 KB Output is correct
21 Correct 873 ms 137728 KB Output is correct
22 Correct 851 ms 137728 KB Output is correct
23 Correct 915 ms 137728 KB Output is correct
24 Correct 833 ms 137728 KB Output is correct
25 Correct 843 ms 137728 KB Output is correct
26 Correct 841 ms 137728 KB Output is correct
27 Correct 853 ms 137728 KB Output is correct
28 Correct 843 ms 137728 KB Output is correct
29 Correct 849 ms 137728 KB Output is correct
30 Correct 909 ms 137728 KB Output is correct