Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx")
- #pragma GCC optimize 03
- #pragma GCC optimize("unroll-loops")
- #include <iostream>
- #include <iomanip>
- #include <algorithm>
- #include <iterator>
- #include <cmath>
- #include <ctime>
- #include <vector>
- #include <deque>
- #include <queue>
- #include <set>
- #include <map>
- #include <stack>
- #include <string>
- #include <random>
- #include <numeric>
- #include <unordered_set>
- typedef long long ll;
- typedef long double lb;
- #define fast ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
- #define file_in freopen("input.txt", "r", stdin);
- #define file_in_out freopen("cutting.in", "r", stdin); freopen("cutting.out", "w", stdout);
- #define mp make_pair
- #define all(x) (x).begin(), (x).end()
- #define fi first
- #define se second
- using namespace std;
- const lb pi = atan2((lb)0, (lb)-1);
- struct point {
- ll x, y;
- point() {
- x = 0; y = 0;
- }
- point(ll _x, ll _y) {
- x = _x; y = _y;
- }
- };
- struct vec {
- ll x, y;
- lb mod;
- vec(point p1, point p2) {
- x = p2.x - p1.x;
- y = p2.y - p1.y;
- mod = sqrt(x * x + y * y);
- }
- };
- istream& operator>>(istream& in, point& p) {
- cin >> p.x >> p.y;
- return in;
- }
- ostream& operator<<(ostream& out, point& p) {
- cout << p.x << " " << p.y;
- return out;
- }
- ll scalar(vec v1, vec v2) {
- return v1.x * v2.x + v1.y * v2.y;
- }
- ll crossv(vec v1, vec v2) {
- return v1.x * v2.y - v1.y * v2.x;
- }
- ll sign(ll n) {
- if (n == 0) {
- return n;
- } else {
- return n / abs(n);
- }
- }
- int main() {
- fast
- // file_in
- // file_in_out
- point A, O, B, P;
- cin >> A >> O >> B >> P;
- vec v1(O, P), v2(O, A), v3(O, B);
- ll cr1 = sign(crossv(v1, v2));
- ll cr2 = sign(crossv(v1, v3));
- if (cr1 * cr2 <= 0) {
- if (acos(scalar(v1, v2) / (v1.mod * v2.mod)) <= pi / 2 || acos(scalar(v1, v3) / (v1.mod * v3.mod)) <= pi / 2) {
- cout << "YES" << "\n";
- } else {
- cout << "NO" << "\n";
- }
- } else {
- cout << "NO" << "\n";
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement