Skip to content

Instantly share code, notes, and snippets.

@kunishi
Created October 8, 2015 02:31
Show Gist options
  • Save kunishi/f28b5d118520b85961eb to your computer and use it in GitHub Desktop.
Save kunishi/f28b5d118520b85961eb to your computer and use it in GitHub Desktop.
/* @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