Advertisement
Guest User

Untitled

a guest
Jun 15th, 2012
217
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.53 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main()
  5. {
  6. const int MAX_COORDINATE = 10000;
  7. int skyline[MAX_COORDINATE]={0};
  8. while(cin.eof()!=0)
  9. {
  10. int L,H,R;
  11. cin>>L>>H>>R;
  12. for(int x=L;x<R;x++)
  13. {
  14. if(H>skyline[x])
  15. {
  16. skyline[x]=H;
  17. }
  18. }
  19. }
  20.  
  21. bool firstOne=true;
  22. int lastHeight=0;
  23. for(int x=0;x<MAX_COORDINATE;x++)
  24. {
  25. if( skyline[x]!=lastHeight )
  26. {
  27. if(firstOne)
  28. {
  29. cout<<x<<" "<<skyline[x];
  30. }
  31. else
  32. {
  33. cout<<" "<<x<<" "<<skyline[x];
  34. }
  35. }
  36. }
  37. return 0;
  38. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement