# |
제출 시각 |
아이디 |
문제 |
언어 |
결과 |
실행 시간 |
메모리 |
67847 |
2018-08-15T11:04:13 Z |
Vahan |
벽 (IOI14_wall) |
C++17 |
|
3000 ms |
34688 KB |
#include "wall.h"
#include<algorithm>
using namespace std;
int t[17000000];
void update(int l,int r,int L,int R,int v,int a,int b)
{
if(l>r)
return;
if(l==L && r==R && t[v]!=-1)
{
if(t[v]<a && b==1)
t[v]=a;
if(t[v]>a && b==2)
t[v]=a;
return;
}
if(t[v]!=-1)
{
t[2*v]=t[v];
t[2*v+1]=t[v];
t[v]=-1;
}
int mid=(L+R)/2;
update(l,min(mid,r),L,mid,2*v,a,b);
update(max(l,mid+1),r,mid+1,R,2*v+1,a,b);
}
int get(int l,int r,int v,int a)
{
if(l==r)
return t[v];
if(t[v]!=-1)
{
t[2*v]=t[v];
t[2*v+1]=t[v];
t[v]=-1;
}
int mid=(l+r)/2;
if(a<=mid)
get(l,mid,2*v,a);
else
get(mid+1,r,2*v+1,a);
}
void buildWall(int n, int k, int op[], int left[], int right[], int height[], int finalHeight[])
{
for(int i=0;i<k;i++)
update(left[i],right[i],0,n-1,1,height[i],op[i]);
for(int i=0;i<n;i++)
finalHeight[i]=get(0,n-1,1,i);
return;
}
Compilation message
wall.cpp: In function 'int get(int, int, int, int)':
wall.cpp:42:1: warning: control reaches end of non-void function [-Wreturn-type]
}
^
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
272 KB |
Output is correct |
2 |
Correct |
4 ms |
616 KB |
Output is correct |
3 |
Correct |
5 ms |
664 KB |
Output is correct |
4 |
Correct |
152 ms |
992 KB |
Output is correct |
5 |
Correct |
8 ms |
1044 KB |
Output is correct |
6 |
Correct |
9 ms |
1168 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
1168 KB |
Output is correct |
2 |
Correct |
205 ms |
14792 KB |
Output is correct |
3 |
Execution timed out |
3046 ms |
14792 KB |
Time limit exceeded |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
14792 KB |
Output is correct |
2 |
Correct |
4 ms |
14792 KB |
Output is correct |
3 |
Correct |
5 ms |
14792 KB |
Output is correct |
4 |
Correct |
151 ms |
14792 KB |
Output is correct |
5 |
Correct |
10 ms |
14792 KB |
Output is correct |
6 |
Correct |
8 ms |
14792 KB |
Output is correct |
7 |
Correct |
2 ms |
14792 KB |
Output is correct |
8 |
Correct |
230 ms |
24740 KB |
Output is correct |
9 |
Execution timed out |
3045 ms |
24740 KB |
Time limit exceeded |
10 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
24740 KB |
Output is correct |
2 |
Correct |
4 ms |
24740 KB |
Output is correct |
3 |
Correct |
7 ms |
24740 KB |
Output is correct |
4 |
Correct |
162 ms |
24740 KB |
Output is correct |
5 |
Correct |
7 ms |
24740 KB |
Output is correct |
6 |
Correct |
10 ms |
24740 KB |
Output is correct |
7 |
Correct |
2 ms |
24740 KB |
Output is correct |
8 |
Correct |
238 ms |
34688 KB |
Output is correct |
9 |
Execution timed out |
3035 ms |
34688 KB |
Time limit exceeded |
10 |
Halted |
0 ms |
0 KB |
- |