Personal nest in the information age

UVa OJ 105 – The Skyline Problem

Problem link

Solution code

using namespace std;
int main(void){
	int skyline[10000]={0};
	int L,H,R;
	int rightest=0;
	while(scanf("%d %d %d",&L,&H,&R) != EOF){
			if(H > skyline[L])
		if(R > rightest)
			rightest = R;
	for(int i=1;i<=rightest;++i)
		if(skyline[i-1] != skyline[i]){
			printf("%d %d",i,skyline[i]);
			if(i != rightest)
				printf(" ");
	return 0;

Leave a comment

Your email address will not be published. Required fields are marked *