AquaBlitz11

Missing Skyline

Mar 18th, 2019
200
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.44 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3.  
  4. int hi[30010];
  5. int main()
  6. {
  7.     int n;
  8.     scanf("%d", &n);
  9.     while (n--) {
  10.         int l, r, h;
  11.         scanf("%d%d%d", &l, &r, &h);
  12.         for (int i = l; i < r; ++i) {
  13.             if (h > hi[i])
  14.                 hi[i] = h;
  15.         }
  16.     }
  17.     for (int i = 1; i <= 30000; ++i) {
  18.         if (hi[i] != hi[i-1])
  19.             printf("%d %d\n", i, hi[i]);
  20.     }
  21.  
  22.     return 0;
  23. }
Add Comment
Please, Sign In to add comment