0
1
mirror of https://git.sb/baoshuo/OI-codes.git synced 2024-11-10 05:18:49 +00:00

P1904 天际线

R52352351
This commit is contained in:
Baoshuo Ren 2021-07-03 20:30:49 +08:00 committed by Baoshuo Ren
parent 9e5aa29038
commit a65d24c602
Signed by: baoshuo
GPG Key ID: 70F90A673FB1AB68

View File

@ -0,0 +1,22 @@
#include <bits/stdc++.h>
using namespace std;
int l, h, r, ml, mr, a[10005];
int main() {
while (cin >> l >> h >> r) {
ml = min(ml, l);
mr = max(mr, r);
for (int i = l; i < r; i++) {
a[i] = max(a[i], h);
}
}
for (int i = ml - 1; i <= mr; i++) {
if (a[i] != a[i - 1]) {
cout << i << ' ' << a[i] << ' ';
}
}
cout << endl;
return 0;
}