Uva 105 - The Skyline Problem

Sep 26, 2015

problem: The Skyline Problem (download)
Description:[Ad hoc, Brute force] 
1.    First store height in H[10000] array according to the low:
2.    Always lower limit =1 & let upper limit=0;
3.    Each time we take input(Left,Height,Right co-ordinate)
4.    From left to right , if H[i]>height, then H[i]=height
5.    End of taking Input, print the H[N], According to the description of output


Example:    H[10000]={0,0,0,0,……,0}
Take input 1 11 5
H[]={11,11,11,11,0,0,0……,0}
Take input 2 6 7
H[]={11,11,11,11,6,6,0,0,0……,0} [since 11>7]
Take input 3 13 9
H[]={11,11,13,13,13,13,13,13,0,0,0,…….} [since 11<13 nbsp="" p="">Take input 12 7 16
H[]={11 ,11,13,13,13,13,13,13,0,0,0,7,7,7,7,0,0…..}  

Result: 1 11 3 13 0 9 12 7
code:

No comments:

Post a Comment