/**
* author: wxhtzdy
* created: 03.07.2022 11:30:53
**/
#include <bits/stdc++.h>
using namespace std;
typedef double ldb;
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
int n, h;
cin >> n >> h;
vector<int> x(n), y(n);
for (int i = 0; i < n; i++) {
cin >> x[i] >> y[i];
}
vector<pair<ldb, ldb>> ev;
for (int i = 2; i < n - 1; i += 2) {
ldb L = (ldb) x[i] + (ldb) h * (((ldb) x[i - 1] - x[i] + 0.00) / (ldb) (y[i - 1] - y[i] + 0.00));
ldb R = (ldb) x[i] + (ldb) h * (((ldb) x[i + 1] - x[i] + 0.00) / (ldb) (y[i + 1] - y[i] + 0.00));
ev.emplace_back(L, R);
cout << fixed << setprecision(5) << L << " " << R << '\n';
}
sort(ev.begin(), ev.end());
int ans = 0;
ldb ptr = -1e20;
for (auto& p : ev) {
if (ptr < p.first) {
ptr = p.second;
ans += 1;
} else {
ptr = min(ptr, p.second);
}
}
cout << ans << '\n';
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
8 ms |
852 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
4 ms |
340 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
8 ms |
852 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |