# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
289554 |
2020-09-02T18:07:29 Z |
cheetose |
Wall (IOI14_wall) |
C++11 |
|
1 ms |
384 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]=1;
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
384 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
384 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
384 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
384 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |