Created
October 8, 2015 02:31
-
-
Save kunishi/f28b5d118520b85961eb to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* @JUDGE_ID: 26089BN 105 C "" */ | |
#include <stdio.h> | |
#include <stdlib.h> | |
#define MAX 10000 | |
int main() { | |
int height[MAX]; | |
int i; | |
int from, to, h; | |
int prev = 0; | |
int isFirst = 0; | |
int maxx = 0; | |
for (i = 0; i < MAX; i ++) { | |
height[i] = 0; | |
} | |
while (scanf("%d %d %d", &from, &h, &to) == 3) { | |
for (i = from; i < to; i ++) { | |
if (height[i] < h) { | |
height[i] = h; | |
} | |
if (maxx < to) { | |
maxx = to; | |
} | |
} | |
} | |
for (i = 0; i < maxx + 1; i ++) { | |
if (height[i] != prev) { | |
if (isFirst == 0) { | |
isFirst = 1; | |
} else { | |
printf(" "); | |
} | |
printf("%d %d", i, height[i]); | |
prev = height[i]; | |
} | |
} | |
printf("\n"); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment