# |
제출 시각 |
아이디 |
문제 |
언어 |
결과 |
실행 시간 |
메모리 |
751527 |
2023-05-31T16:55:53 Z |
amin |
벽 (IOI14_wall) |
C++14 |
|
1036 ms |
84552 KB |
#include "wall.h"
#include <bits/stdc++.h>
using namespace std;
#define ll long long
int ma[8000000];
int mi[8000000];
int a[4000003];
int z;
int b[2000003];
int ans=0;
int n;
void push(int v)
{
//cout<<v<<endl;
if(ma[v]<ma[v*2]&&ma[v]<mi[v*2])
{
// cout<<v<<endl;
ma[v*2]=mi[v*2]=ma[v];
}else
if(mi[v]>mi[v*2]&&mi[v]>ma[v*2])
{
mi[v*2]=ma[v*2]=mi[v];
// cout<<v<<endl;
}
else
{
mi[v*2]=max(mi[v*2],mi[v]);
ma[v*2]=min(ma[v*2],ma[v]);
}
if(ma[v]<ma[v*2+1]&&ma[v]<mi[v*2+1])
{
// cout<<v<<endl;
ma[v*2+1]=mi[v*2+1]=ma[v];
}else
if(mi[v]>mi[v*2+1]&&mi[v]>ma[v*2+1])
{
// cout<<v<<endl;
mi[v*2+1]=ma[v*2+1]=mi[v];
}
else
{
mi[v*2+1]=max(mi[v*2+1],mi[v]);
ma[v*2+1]=min(ma[v*2+1],ma[v]);
}
mi[v]=0;
ma[v]=1e9;
}
void update(int v,int tl,int tr,int l,int r,int t,int val)
{
// cout<<tl<<' '<<tr<<endl;
if(l>r)
return ;
if(tl==l&&tr==r)
{
// cout<<tl<<' '<<tr<<endl;
if(t==1)
{
mi[v]=max(mi[v],val);
ma[v]=max(mi[v],ma[v]);
}else
{
ma[v]=min(ma[v],val);
mi[v]=min(mi[v],ma[v]);
}
/* if(tl==3&&tr==5)
{
// cout<<mi[v]<<' '<<ma[v]<<endl;
}*/
return ;
}
// cout<<tl<<' '<<tr<<endl;
push(v);
int tm=(tl+tr)>>1;
update(v*2,tl,tm,l,min(r,tm),t,val);
update(v*2+1,tm+1,tr,max(tm+1,l),r,t,val);
// merg(v,v*2,v*2+1);
}
int get(int v,int tl,int tr,int pos)
{
if(tl>pos||pos>tr)
return 1000000001;
if(tl==tr)
{
// cout<<ma[v]<<endl;
return mi[v];
// cout<<ma[v]<<endl;
}
push(v);
int tm=(tl+tr)/2;
return min(get(v*2,tl,tm,pos),get(v*2+1,tm+1,tr,pos));
}
void buildWall(int n, int k, int op[], int left[], int right[], int height[], int finalHeight[])
{
for(int i=0;i<4*n;i++)
{
ma[i]=1000000000;
}
for(int i=0;i<k;i++)
{
update(1,0,n-1,left[i],right[i],op[i],height[i]);
}
for(int i=0;i<n;i++)
{
finalHeight[i]=get(1,0,n-1,i);
}
return ;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
2 ms |
340 KB |
Output is correct |
3 |
Correct |
2 ms |
340 KB |
Output is correct |
4 |
Correct |
6 ms |
724 KB |
Output is correct |
5 |
Correct |
5 ms |
724 KB |
Output is correct |
6 |
Correct |
5 ms |
724 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
127 ms |
8044 KB |
Output is correct |
3 |
Correct |
210 ms |
4168 KB |
Output is correct |
4 |
Correct |
464 ms |
11264 KB |
Output is correct |
5 |
Correct |
266 ms |
11836 KB |
Output is correct |
6 |
Correct |
255 ms |
11772 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
2 ms |
340 KB |
Output is correct |
3 |
Correct |
2 ms |
340 KB |
Output is correct |
4 |
Correct |
7 ms |
724 KB |
Output is correct |
5 |
Correct |
5 ms |
724 KB |
Output is correct |
6 |
Correct |
5 ms |
724 KB |
Output is correct |
7 |
Correct |
0 ms |
212 KB |
Output is correct |
8 |
Correct |
127 ms |
8152 KB |
Output is correct |
9 |
Correct |
177 ms |
4244 KB |
Output is correct |
10 |
Correct |
491 ms |
11260 KB |
Output is correct |
11 |
Correct |
250 ms |
11772 KB |
Output is correct |
12 |
Correct |
257 ms |
11776 KB |
Output is correct |
13 |
Correct |
0 ms |
212 KB |
Output is correct |
14 |
Correct |
133 ms |
8056 KB |
Output is correct |
15 |
Correct |
33 ms |
1452 KB |
Output is correct |
16 |
Correct |
514 ms |
11512 KB |
Output is correct |
17 |
Correct |
252 ms |
11468 KB |
Output is correct |
18 |
Correct |
264 ms |
11648 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
2 ms |
340 KB |
Output is correct |
3 |
Correct |
1 ms |
340 KB |
Output is correct |
4 |
Correct |
7 ms |
724 KB |
Output is correct |
5 |
Correct |
6 ms |
724 KB |
Output is correct |
6 |
Correct |
6 ms |
724 KB |
Output is correct |
7 |
Correct |
0 ms |
212 KB |
Output is correct |
8 |
Correct |
127 ms |
8192 KB |
Output is correct |
9 |
Correct |
160 ms |
4244 KB |
Output is correct |
10 |
Correct |
467 ms |
11260 KB |
Output is correct |
11 |
Correct |
303 ms |
11764 KB |
Output is correct |
12 |
Correct |
254 ms |
11756 KB |
Output is correct |
13 |
Correct |
1 ms |
212 KB |
Output is correct |
14 |
Correct |
132 ms |
8084 KB |
Output is correct |
15 |
Correct |
32 ms |
1484 KB |
Output is correct |
16 |
Correct |
512 ms |
11520 KB |
Output is correct |
17 |
Correct |
256 ms |
11596 KB |
Output is correct |
18 |
Correct |
286 ms |
11560 KB |
Output is correct |
19 |
Correct |
1022 ms |
74052 KB |
Output is correct |
20 |
Correct |
999 ms |
81860 KB |
Output is correct |
21 |
Correct |
1000 ms |
84528 KB |
Output is correct |
22 |
Correct |
1000 ms |
81880 KB |
Output is correct |
23 |
Correct |
981 ms |
82052 KB |
Output is correct |
24 |
Correct |
991 ms |
81848 KB |
Output is correct |
25 |
Correct |
961 ms |
81964 KB |
Output is correct |
26 |
Correct |
1002 ms |
84552 KB |
Output is correct |
27 |
Correct |
954 ms |
84428 KB |
Output is correct |
28 |
Correct |
987 ms |
81928 KB |
Output is correct |
29 |
Correct |
968 ms |
81896 KB |
Output is correct |
30 |
Correct |
1036 ms |
82000 KB |
Output is correct |