Submission #1010072

#TimeUsernameProblemLanguageResultExecution timeMemory
1010072somefjordPortal (BOI24_portal)C++17
0 / 100
38 ms2612 KiB
#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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...