This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
int product(int x1, int y1, int x2, int y2) { return x1 * y2 - x2 * y1; }
int vproduct(pair<int, int> &a, pair<int, int> &b) {
return product(a.first, a.second, b.first, b.second);
}
pair<int, int> vec(pair<int, int> &a, pair<int, int> &b) {
auto [x1, y1] = a;
auto [x2, y2] = b;
return {x2 - x1, y2 - y1};
}
int main() {
int n;
cin >> n;
vector<pair<int, int>> portals(n);
int x, y;
for (auto &p : portals) {
cin >> x >> y;
p = {x, y};
}
auto v1 = vec(portals[0], portals[1]);
auto v2 = vec(portals[0], portals[2]);
auto a = abs(vproduct(v1, v2));
cout << (a ? a : -1);
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |