# |
제출 시각 |
아이디 |
문제 |
언어 |
결과 |
실행 시간 |
메모리 |
757591 |
2023-06-13T11:58:53 Z |
lucri |
벽 (IOI14_wall) |
C++17 |
|
282 ms |
13880 KB |
#include <bits/stdc++.h>
#include "wall.h"
struct arboreintervale{int val,lazy,lim;}aint[8000010];
void propaga(int poz,int b,int e)
{
if(aint[poz].lazy>aint[poz].lim)
aint[poz].lazy=aint[poz].lim;
if(b==e)
aint[poz].val=aint[poz].lazy;
else
{
if(aint[poz].lazy>=aint[poz*2].lazy||aint[poz].lazy>=aint[poz*2].lim)
{
aint[poz*2].lazy=aint[poz].lazy;
aint[poz*2].lim=std::min(aint[poz*2].lim,aint[poz].lim);
if(aint[poz*2].lim<aint[poz*2].lazy)
aint[poz*2].lim=aint[poz*2].lazy;
}
else
aint[poz*2].lim=std::min(aint[poz*2].lim,aint[poz].lim);
if(aint[poz].lazy>=aint[poz*2+1].lazy||aint[poz].lazy>=aint[poz*2+1].lim)
{
aint[poz*2+1].lazy=aint[poz].lazy;
aint[poz*2+1].lim=std::min(aint[poz*2+1].lim,aint[poz].lim);
if(aint[poz*2+1].lim<aint[poz*2+1].lazy)
aint[poz*2+1].lim=aint[poz*2+1].lazy;
}
else
aint[poz*2+1].lim=std::min(aint[poz*2+1].lim,aint[poz].lim);
aint[poz].lim=2000000010;
aint[poz].lazy=0;
}
}
void atribuie(int poz,int b,int e,int bi,int ei,int val)
{
propaga(poz,b,e);
if(e<bi||ei<b)
return;
if(bi<=b&&e<=ei)
{
aint[poz].lazy=val;
aint[poz].lim=2000000010;
return;
}
atribuie(poz*2,b,(b+e)/2,bi,ei,val);
atribuie(poz*2+1,(b+e)/2+1,e,bi,ei,val);
}
void limiteaza(int poz,int b,int e,int bi,int ei,int val)
{
propaga(poz,b,e);
if(e<bi||ei<b)
return;
if(bi<=b&&e<=ei)
{
aint[poz].lim=val;
return;
}
limiteaza(poz*2,b,(b+e)/2,bi,ei,val);
limiteaza(poz*2+1,(b+e)/2+1,e,bi,ei,val);
}
int pozac;
void finalans(int poz,int b,int e,int ans[])
{
propaga(poz,b,e);
if(b==e)
{
ans[pozac++]=aint[poz].val;
return;
}
finalans(poz*2,b,(b+e)/2,ans);
finalans(poz*2+1,(b+e)/2+1,e,ans);
}
void buildWall(int n, int k, int op[], int left[], int right[], int height[], int finalHeight[])
{
aint[1].lim=2000000010;
for(int i=0;i<k;++i)
{
++left[i];
++right[i];
if(op[i]==1)
atribuie(1,1,n,left[i],right[i],height[i]);
else
limiteaza(1,1,n,left[i],right[i],height[i]);
}
finalans(1,1,n,finalHeight);
return;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
2 ms |
340 KB |
Output is correct |
3 |
Incorrect |
3 ms |
340 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
132 ms |
13880 KB |
Output is correct |
3 |
Incorrect |
282 ms |
8168 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
2 ms |
340 KB |
Output is correct |
3 |
Incorrect |
2 ms |
340 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
3 ms |
452 KB |
Output is correct |
3 |
Incorrect |
2 ms |
340 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |