Submission #307178

#TimeUsernameProblemLanguageResultExecution timeMemory
307178amunduzbaevWall (IOI14_wall)C++14
8 / 100
3073 ms11384 KiB
#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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...