Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <vector>
- #include <algorithm>
- #include <queue>
- #include <cmath>
- #include <set>
- #include <stack>
- #include <bitset>
- #include <map>
- #include <ctime>
- #include <numeric>
- #include <random>
- #ifndef M_PI
- #define M_PI 3.141592653589
- #endif
- #define int long long
- #define uint unsigned long long
- #define double long double
- #ifdef TIME
- #define start cin.tie(NULL); cout.tie(NULL); cout.setf(ios::fixed); cout.precision(10); ios_base::sync_with_stdio(false);int32_t START = clock()
- #define finish cout << "\ntime: " << (clock() - START) / (CLOCKS_PER_SEC * 1.0); return 0
- #endif
- #ifndef TIME
- #define start cin.tie(NULL); cout.tie(NULL); cout.setf(ios::fixed); cout.precision(10); ios_base::sync_with_stdio(false)
- #define finish return 0
- #endif
- using namespace std;
- //vector input
- template<typename T>
- istream &operator>>(istream &is, vector<T> &vec) {
- for (auto &i : vec) {
- cin >> i;
- }
- return is;
- }
- //pair output
- template<typename E>
- ostream &operator<<(ostream &os, pair<E, E> &t) {
- os << t.first << ' ' << t.second;
- return os;
- }
- //"map" pair output
- template<typename E>
- ostream &operator<<(ostream &os, pair<const E, E> &t) {
- os << t.first << ' ' << t.second;
- return os;
- }
- //vector output
- template<typename T>
- ostream &operator<<(ostream &os, vector<T> &vec) {
- for (T i : vec) {
- os << i << ' ';
- }
- return os;
- }
- //2 dimensional vector output
- template<typename T>
- ostream &operator<<(ostream &os, vector<vector<T> > &vec) {
- for (vector<T> i : vec) {
- os << i << '\n';
- }
- return os;
- }
- struct point {
- double x, y;
- point(double _x, double _y) : x(_x), y(_y) {}
- point() : x(0), y(0) {}
- };
- struct vec {
- double x, y;
- vec(point begin, point end) {
- x = end.x - begin.x;
- y = end.y - begin.y;
- }
- vec(point end) {
- x = end.x;
- y = end.y;
- }
- double length() {
- return sqrt(x * x + y * y);
- }
- vec operator+(vec &b) const {
- vec c(point(x + b.x, y + b.y));
- return c;
- }
- double operator*(vec &b) const {
- return x * b.x + y * b.y;
- }
- double operator^(vec &b) const {
- return x * b.y - y * b.x;
- }
- };
- int32_t main() {
- start;
- int xp, yp, xa, ya, xb, yb, xo, yo;
- cin >> xa >> ya;
- cin >> xo >> yo;
- cin >> xb >> yb;
- cin >> xp >> yp;
- point a(xa, ya), o(xo, yo), b(xb, yb), p(xp, yp);
- vec oa(o, a), op(o, p), ob(o, b);
- if (((ob ^ op) >= 0 && (op ^ oa) >= 0 && (ob ^ oa) >= 0) || ((oa ^ op) >= 0 && (op ^ ob) >= 0 && (oa ^ ob) >= 0)) {
- cout << "YES" << '\n';
- } else {
- cout << "NO" << '\n';
- }
- finish;
- }
Advertisement
Add Comment
Please, Sign In to add comment