This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "wall.h"
#include <bits/stdc++.h>
//#include "grader.cpp"
using namespace std;
void buildWall(int n, int k, int w[], int l[], int r[], int h[], int a[]){
for(int i=0;i<k;i++){
if(w[i]==1){
for(int j=l[i];j<=r[i];j++){
if(a[j]<h[i])
a[j]=h[i];
}
} else {
for(int j=l[i];j<=r[i];j++){
if(a[j]>h[i])
a[j]=h[i];
}
}
}
return ;
}
/*
int now,n;
struct stree{
vector<int>v;
int s=1;
void mtree(int n){
while(s<n)s*=2;
v.assign(s*2-1,0);
}
void st1(int i,int e,int x,int lx,int rx){
if(rx==lx+1){
if((v[x]<e&&now==1)||(v[x]>e&&now==2))
v[x]=e;
return;
}
int m=(lx+rx)/2;
if(i<m){
st1(i,e,x*2+1,lx,m);
}else{
st1(i,e,x*2+2,m,rx);
}
v[x]=v[x*2+2]+v[x*2+1];
}
void st(int i,int e){
st1(i,e,0,0,s);
}
void print(){
for(int i=0;i<v.size();i++){
cout<<v[i]<<" ";
}cout<<"\n";
}
void give(int a[]){
for(int i=s;i<s+n;i++){
a[i-s]=v[i];
}
}
};
n=N;
stree t;
t.mtree(n);
for(int i=0;i<k;i++){
now=w[i];
for(int j=l[i];j<=r[i];j++){
t.st(j,h[i]);
}
}
t.print();
a=t.give(a);
10 6
1 1 8 4
2 4 9 1
2 3 6 5
1 0 5 3
1 2 2 5
2 6 7 0
*/
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |