# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
1113641 |
2024-11-16T22:00:15 Z |
I_FloPPed21 |
Wall (IOI14_wall) |
C++14 |
|
1 ms |
2384 KB |
#include <iostream>
#include <wall.h>
using namespace std;
const int N=2e6+5.;
struct zid
{
int big,small;
} seg[4*N],lazy[4*N];
bool to_propag[4*N];
void propaga(int nod)
{
if(to_propag[nod]==false)
return;
lazy[nod*2].small=lazy[nod].small;
lazy[nod*2+1].small=lazy[nod].small;
lazy[nod*2].big=lazy[nod].big;
lazy[nod*2+1].big=lazy[nod].big;
seg[nod*2].big=lazy[nod].big;
seg[nod*2+1].big=lazy[nod].big;
seg[nod*2].small=lazy[nod].small;
seg[nod*2+1].small=lazy[nod].small;
to_propag[nod]=false;
to_propag[nod*2]=true;
to_propag[nod*2+1]=true;
}
void update(int nod,int st,int dr,int l,int r,int val,int tip)
{
if(l<=st&&dr<=r)
{
to_propag[nod]=true;
if(tip==1)
{
seg[nod].big=max(val,seg[nod].big);
seg[nod].small=max(seg[nod].small,seg[nod].big);
lazy[nod].big=seg[nod].big;
lazy[nod].small=max(seg[nod].big,seg[nod].small);
}
else
{
seg[nod].small=min(val,seg[nod].small);
seg[nod].big=min(seg[nod].small,seg[nod].big);
lazy[nod].small=seg[nod].small;
lazy[nod].big=min(seg[nod].small,seg[nod].big);
}
}
else if(l>dr||st>r)
return;
else
{
propaga(nod);
int mij=(st+dr)/2;
update(nod*2,st,mij,l,r,val,tip);
update(nod*2+1,mij+1,dr,l,r,val,tip);
}
}
int query(int nod,int st,int dr,int poz)
{
if(st==dr)
{
return seg[nod].big;
}
else
{
propaga(nod);
int mij=(st+dr)/2;
if(poz<=mij)
return query(nod*2,st,mij,poz);
else
return query(nod*2+1,mij+1,dr,poz);
}
}
void buildWall(int n,int k,int op[],int left[],int right[],int height[],int finalheight[])
{
for(int i=1; i<=k; i++)
{
int l=left[i-1];
int r=right[i-1];
int tip=op[i];
l++,r++;
int val=height[i-1];
update(1,1,n,l,r,val,tip);
}
for(int i=1; i<=n; i++)
finalheight[i-1]=query(1,1,n,i);
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
2384 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
2384 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
2384 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
2384 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |