Submit Info #48125

Problem Lang User Status Time Memory
Sort Points by Argument cpp (anonymous) AC 79 ms 7.68 MiB

ケース詳細
Name Status Time Memory
example_00 AC 2 ms 0.68 MiB
max_random_00 AC 76 ms 7.67 MiB
max_random_01 AC 77 ms 7.68 MiB
max_random_02 AC 77 ms 7.63 MiB
near_arg_00 AC 78 ms 7.55 MiB
near_arg_01 AC 79 ms 7.55 MiB
near_arg_02 AC 79 ms 7.55 MiB
near_arg_shuffle_00 AC 77 ms 7.55 MiB
near_arg_shuffle_01 AC 78 ms 7.59 MiB
near_arg_shuffle_02 AC 79 ms 7.55 MiB
only_x_axis_00 AC 0 ms 0.71 MiB
random_00 AC 53 ms 5.21 MiB
random_01 AC 59 ms 5.93 MiB
random_02 AC 21 ms 2.55 MiB
small_all_00 AC 2 ms 0.68 MiB

#include <bits/stdc++.h> #define X first #define Y second #define MP make_pair #define ll long long #define ld long double using namespace std; const int N = 2e5 + 112; const ld EPS = 1e-10; struct Point{ ll x, y; int tp() const { if(y < 0) return -1; if(y == 0 && 0 <= x) return 0; return 1; } bool operator < (const Point &oth) const { if(tp() != oth.tp()) return tp() < oth.tp(); return 0 < (x * oth.y - oth.x * y); } }a[N]; int n; int main () { ios::sync_with_stdio(0), cin.tie(0), cout.tie(0); cin >> n; for(int i = 1;i <= n;i++) cin >> a[i].x >> a[i].y; sort(a + 1, a + n + 1); for(int i = 1;i <= n;i++) cout << a[i].x << " " << a[i].y << "\n"; }