Submission #237877

# Submission time Handle Problem Language Result Execution time Memory
237877 2020-06-09T07:15:56 Z Fasho Wall (IOI14_wall) C++14
0 / 100
3000 ms 14072 KB
#include <bits/stdc++.h>
#define N 1000005
#define ll long long int 	
#define MP make_pair
#define pb push_back
#define ppb pop_back
#define sp " "
#define endl "\n"
#define fi first
#define se second
#define ii pair<int,int>
#define lli pair<ll,ll>
#define fast cin.tie(0);cout.tie(0);ios_base::sync_with_stdio(false)
#define fast2 freopen ("badhair.gir","r",stdin);freopen ("badhair.cik","w",stdout);
#define mod 1000000007
#define fs(x,y) for(ll i=1;i<=y;i++) cin>>x[i]
#define fo(i,x,y) for(ll i=x;i<=y;i++)
#define INF 1000000000005
#define ull unsigned long long int
// #define left lef
// #define right rig

using namespace std;

ll m,ar[N],sum,t,tree[6*N];
lli lazy[N];
int n,  k,  op[N],  left[N],  right[N],  height[N],  finalHeight[N];

void push(ll ind,int l,int r)
{
	if(lazy[ind].se==1)
		tree[ind]=max(tree[ind],lazy[ind].fi);
	
	if(lazy[ind].se==2)
		tree[ind]=min(tree[ind],lazy[ind].fi);
	if(l!=r)
	{
		int mid=(l+r)/2;
		push(ind*2,l,mid);
		push(ind*2+1,mid+1,r);
		lazy[ind*2]=lazy[ind];
		lazy[ind*2+1]=lazy[ind];
	}
	lazy[ind]={0,0};
}
ll query(int ind,int l,int r,int a)
{
	if(l>a || r<a)
		return 0;
	push(ind,l,r);
	if(l==r)
		return tree[ind];
	int mid=(l+r)/2;
	if(mid>=a)
		return query(ind*2,l,mid,a);
	return query(ind*2+1,mid+1,r,a);

}

void upd(int ind,int l,int r,int a,int b,ll x,int typ)
{
	if(l>b || r<a)
		return;
	push(ind,l,r);
	if(l>=a && r<=b)
	{
		lazy[ind]={x,typ};
		push(ind,l,r);
		return;
	}
	int mid=(l+r)/2;
	upd(ind*2,l,mid,a,b,x,typ);
	upd(ind*2+1,mid+1,r,a,b,x,typ);
	return;
}
void buildWall(int n, int k, int op[], int left[], int right[], int height[], int finalHeight[]){
// void buildWall(){

	fo(i,0,k-1)
		upd(1,1,n,left[i]+1,right[i]+1,height[i],op[i]);

	fo(i,1,n)
		finalHeight[i-1]=query(1,1,n,i);
	return;
}




// int main()
// {
// 	fast;
// 	cin>>n>>k;
// 	fo(i,0,k-1)
// 		cin>>op[i]>>left[i]>>right[i]>>height[i];
// 	cout<<endl;
// 	buildWall();

// 	fo(i,0,n-1)
// 		cout<<finalHeight[i]<<endl;
// }

# Verdict Execution time Memory Grader output
1 Correct 5 ms 256 KB Output is correct
2 Correct 6 ms 512 KB Output is correct
3 Correct 25 ms 384 KB Output is correct
4 Execution timed out 3082 ms 1280 KB Time limit exceeded
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 5 ms 384 KB Output is correct
2 Correct 190 ms 14072 KB Output is correct
3 Execution timed out 3074 ms 8952 KB Time limit exceeded
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 4 ms 384 KB Output is correct
2 Correct 7 ms 512 KB Output is correct
3 Correct 26 ms 384 KB Output is correct
4 Execution timed out 3070 ms 1280 KB Time limit exceeded
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 4 ms 384 KB Output is correct
2 Correct 6 ms 512 KB Output is correct
3 Correct 28 ms 512 KB Output is correct
4 Execution timed out 3073 ms 1280 KB Time limit exceeded
5 Halted 0 ms 0 KB -