#include "wall.h"
#include <bits/stdc++.h>
using namespace std;
#define clamp(x,l,r) x=min(r,max(x,l))
#define all(x) begin(x),end(x)
void buildWall(int n, int k, int op[], int left[], int right[], int height[], int finalHeight[]){
vector<int> wall(n,0);
for(int i = 0; i < k; i++)
{
auto t = op[i];
int l = left[i];
int r = right[i];
int val = height[i];
if(t==1) for(int j = l; j <= r; j++) wall[j] = max(wall[j],val);
else for(int j = l; j <= r; j++) wall[j] = min(wall[j],val);
}
for(auto i : wall) *finalHeight++ = i;
}
# |
결과 |
실행 시간 |
메모리 |
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 |
14 ms |
596 KB |
Output is correct |
5 |
Correct |
14 ms |
540 KB |
Output is correct |
6 |
Correct |
14 ms |
540 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
300 KB |
Output is correct |
2 |
Correct |
101 ms |
9156 KB |
Output is correct |
3 |
Correct |
927 ms |
4768 KB |
Output is correct |
4 |
Execution timed out |
3020 ms |
9632 KB |
Time limit exceeded |
5 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
2 ms |
424 KB |
Output is correct |
3 |
Correct |
1 ms |
340 KB |
Output is correct |
4 |
Correct |
14 ms |
536 KB |
Output is correct |
5 |
Correct |
15 ms |
480 KB |
Output is correct |
6 |
Correct |
14 ms |
540 KB |
Output is correct |
7 |
Correct |
1 ms |
304 KB |
Output is correct |
8 |
Correct |
99 ms |
9036 KB |
Output is correct |
9 |
Correct |
925 ms |
4716 KB |
Output is correct |
10 |
Execution timed out |
3051 ms |
9532 KB |
Time limit exceeded |
11 |
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 |
Correct |
1 ms |
340 KB |
Output is correct |
4 |
Correct |
14 ms |
540 KB |
Output is correct |
5 |
Correct |
14 ms |
548 KB |
Output is correct |
6 |
Correct |
14 ms |
536 KB |
Output is correct |
7 |
Correct |
0 ms |
212 KB |
Output is correct |
8 |
Correct |
99 ms |
9116 KB |
Output is correct |
9 |
Correct |
924 ms |
4812 KB |
Output is correct |
10 |
Execution timed out |
3028 ms |
9524 KB |
Time limit exceeded |
11 |
Halted |
0 ms |
0 KB |
- |