# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
289551 |
2020-09-02T18:01:36 Z |
cheetose |
Wall (IOI14_wall) |
C++11 |
|
3000 ms |
13196 KB |
#include "wall.h"
#include <bits/stdc++.h>
using namespace std;
int mntree[1<<22], mxtree[1<<22], lazy[1<<22];
void propagation(int node, int S, int E)
{
if (lazy[node] != -1)
{
mntree[node] = mxtree[node] = lazy[node];
if (S != E)
{
lazy[2 * node] = lazy[node];
lazy[2 * node + 1] = lazy[node];
}
lazy[node] = -1;
}
}
void upd(int node, int S, int E, int i, int j, int op, int val)
{
propagation(node, S, E);
if (i > E || j < S) return;
if (j >= E && i <= S)
{
if((op==1 && mxtree[node]<=val) || (op==2 && mntree[node]>=val)){
lazy[node]=val;
propagation(node,S,E);
return;
}
}
if(S==E)return;
upd(2 * node, S, (S + E) / 2, i, j, op, val);
upd(2 * node + 1, (S + E) / 2 + 1, E, i, j, op, val);
mntree[node] = min(mntree[2 * node], mntree[2 * node + 1]);
mxtree[node] = max(mxtree[2 * node], mxtree[2 * node + 1]);
}
int find(int node,int S,int E,int i,int j){
propagation(node, S, E);
if (i > E || j < S) return -1;
if (j >= E && i <= S) return mxtree[node];
return max(find(node * 2, S, (S + E) / 2, i, j), find(2 * node + 1, (S + E) / 2 + 1, E, i, j));
}
void buildWall(int n, int k, int op[], int left[], int right[], int height[], int finalHeight[]){
for(int i=0;i<k;i++){
int o=op[i],l=left[i],r=right[i],x=height[i];
upd(1,0,n-1,l,r,o,x);
}
for(int i=0;i<n;i++){
finalHeight[i]=find(1,0,n-1,i,i);
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
288 KB |
Output is correct |
2 |
Correct |
2 ms |
512 KB |
Output is correct |
3 |
Correct |
4 ms |
384 KB |
Output is correct |
4 |
Correct |
191 ms |
1016 KB |
Output is correct |
5 |
Correct |
34 ms |
1024 KB |
Output is correct |
6 |
Correct |
37 ms |
1016 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
384 KB |
Output is correct |
2 |
Correct |
176 ms |
13196 KB |
Output is correct |
3 |
Execution timed out |
3096 ms |
8184 KB |
Time limit exceeded |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
384 KB |
Output is correct |
2 |
Correct |
2 ms |
512 KB |
Output is correct |
3 |
Correct |
4 ms |
384 KB |
Output is correct |
4 |
Correct |
198 ms |
972 KB |
Output is correct |
5 |
Correct |
33 ms |
1016 KB |
Output is correct |
6 |
Correct |
36 ms |
1016 KB |
Output is correct |
7 |
Correct |
1 ms |
384 KB |
Output is correct |
8 |
Correct |
178 ms |
13176 KB |
Output is correct |
9 |
Execution timed out |
3094 ms |
8184 KB |
Time limit exceeded |
10 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
416 KB |
Output is correct |
2 |
Correct |
2 ms |
512 KB |
Output is correct |
3 |
Correct |
4 ms |
416 KB |
Output is correct |
4 |
Correct |
191 ms |
1016 KB |
Output is correct |
5 |
Correct |
33 ms |
1152 KB |
Output is correct |
6 |
Correct |
37 ms |
972 KB |
Output is correct |
7 |
Correct |
1 ms |
384 KB |
Output is correct |
8 |
Correct |
172 ms |
13176 KB |
Output is correct |
9 |
Execution timed out |
3069 ms |
8184 KB |
Time limit exceeded |
10 |
Halted |
0 ms |
0 KB |
- |