Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- #include <algorithm>
- using namespace std;
- using ll = long long;
- using pii = pair<int, int>;
- vector<pii> cords;
- pii getK(pair<int,int> a, pair<int,int> b) {
- a.first -= b.first;
- a.second -= b.second;
- int g = __gcd(abs(a.first), abs(a.first));
- if (g!=0)
- {
- a.first /= g;
- a.second /= g;
- }
- if (a.first==0)
- a.second = 1;
- if (a.second==0)
- a.first = 1;
- return { a.first, a.second };
- }
- int main() {
- ios_base::sync_with_stdio(false);
- cin.tie(nullptr);
- int n;
- cin >> n;
- pii p1, p2;
- cin >> p1.first >> p1.second >> p2.first >> p2.second;
- pii k = getK(p1, p2);
- int check = 0;
- pii el;
- for (int i = 0; i < n - 2; i++) {
- cin >> el.first >> el.second;
- if (k!=getK(p1, el)) {
- check = 1;
- break;
- }
- }
- check ? cout << "no" : cout << "yes";
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement