Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- long long vmul(long long x1, long long y1, long long x2, long long y2) {
- return x1 * y2 - x2 * y1;
- }
- long long smul(long long x1, long long y1, long long x2, long long y2) {
- return x1 * x2 + y1 * y2;
- }
- long long x[42], y[42];
- int main() {
- long long x1, y1, x2, y2;
- cin >> x1 >> y1 >> x2 >> y2;
- x2 -= x1;
- y2 -= y1;
- if (x2 == 0 && y2 == 0) {
- puts("YES");
- return 0;
- }
- int n;
- cin >> n;
- for (int i = 0; i < n; i++) {
- cin >> x[i] >> y[i];
- }
- for (int i = 0; i < n; i++) {
- if (vmul(x[i], y[i], x2, y2) == 0 && smul(x[i], y[i], x2, y2) > 0) {
- puts("YES");
- return 0;
- }
- for (int j = 0; j < n; j++) {
- if (vmul(x[i], y[i], x[j], y[j]) > 0 && vmul(x[i], y[i], x2, y2) > 0 && vmul(x2, y2, x[j], y[j]) > 0) {
- puts("YES");
- return 0;
- }
- }
- }
- puts("NO");
- }
Advertisement
Add Comment
Please, Sign In to add comment