Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- #define all(x) (x).begin(),(x).end()
- using namespace std;
- using ll = long long;
- struct pt {
- int x;
- int y;
- int ind;
- pt(int cx = 0, int cy = 0, int cind = 0) {
- this->x = cx;
- this->y = cy;
- this->ind = cind;
- }
- bool operator < (const pt& o) {
- return x < o.x || (x == o.x && y < o.y);
- }
- pt operator - (const pt& o) const {
- return pt(x - o.x, y - o.y);
- }
- };
- int main() {
- ios_base::sync_with_stdio(false);
- cin.tie(nullptr);
- cout.tie(nullptr);
- int n;
- cin >> n;
- vector<pt> arr(n);
- for (int i = 0; i < n; i++) {
- cin >> arr[i].x >> arr[i].y;
- arr[i].ind = i;
- }
- sort(all(arr));
- sort(arr.begin() + 1, arr.end(), [&] (const pt& a, const pt& b) {
- pt v1 = a - arr[0];
- pt v2 = b - arr[0];
- return v1.x * 1ll * v2.y - v1.y * 1ll * v2.x < 0;
- });
- cout << arr[0].ind + 1 << ' ' << arr[n / 2].ind + 1 << endl;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement