Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- typedef long long ll;
- using namespace std;
- vector <int> a1(3), a2(3);
- long double c[2];
- void F1(int x1, int y1, int x2, int y2) {
- a1[0] = y1 - y2;
- a1[1] = x2 - x1;
- a1[2] = -a1[0] * x1 - a1[1] * y1;
- }
- void F2(int x1, int y1, int x2, int y2) {
- a2[0] = y1 - y2;
- a2[1] = x2 - x1;
- a2[2] = -a2[0] * x1 - a2[1] * y1;
- }
- void F3() {
- c[0] = -(a1[2] * a2[1] - a1[1] * a2[2]) * 1.0;
- c[0] /= (a1[0] * a2[1] - a2[0] * a1[1]);
- c[1] = -(a1[0] * a2[2] - a1[2] * a2[0]) * 1.0;
- c[1] /= (a1[0] * a2[1] - a2[0] * a1[1]);
- }
- int main() {
- ios::sync_with_stdio(0);
- cin.tie(0);
- cout.tie(0);
- ll n, x_0, x_1, x_2, x_3, x_4, y_1, y_2, y_3, y_4;
- cin >> n >> x_0;
- cin >> x_1 >> y_1 >> x_2 >> y_2 >> x_3 >> y_3 >> x_4 >> y_4;
- F1(x_1, y_1, x_2, y_2);
- F2(x_3, y_3, x_4, y_4);
- F3();
- if (x_0 < 0) {
- cout << "YES";
- return 0;
- }
- if (n * n * 1.0 / 10 < abs(x_0)) {
- cout << "NO";
- return 0;
- }
- long double S = x_0 * 10.0 / (n * n);
- if (abs(S) >= 1) {
- cout << "NO";
- return 0;
- }
- double ANG = max(asin(S) / 2, 3.1415926535 / 2 - asin(S) / 2);
- if (c[0] * tan(ANG) - 5.0 * c[0] * c[0] / (n * n * cos(ANG) * cos(ANG)) < c[1]) {
- cout << "NO";
- return 0;
- }
- cout << "YES";
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement