Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main()
- {
- const int MAX_COORDINATE = 10000;
- int skyline[MAX_COORDINATE]={0};
- while(cin.eof()!=0)
- {
- int L,H,R;
- cin>>L>>H>>R;
- for(int x=L;x<R;x++)
- {
- if(H>skyline[x])
- {
- skyline[x]=H;
- }
- }
- }
- bool firstOne=true;
- int lastHeight=0;
- for(int x=0;x<MAX_COORDINATE;x++)
- {
- if( skyline[x]!=lastHeight )
- {
- if(firstOne)
- {
- cout<<x<<" "<<skyline[x];
- }
- else
- {
- cout<<" "<<x<<" "<<skyline[x];
- }
- }
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement