Submit Info #57853

Problem Lang User Status Time Memory
Sort Points by Argument cpp-acl (anonymous) AC 77 ms 7.40 MiB

ケース詳細
Name Status Time Memory
example_00 AC 1 ms 0.45 MiB
max_random_00 AC 74 ms 7.40 MiB
max_random_01 AC 77 ms 7.39 MiB
max_random_02 AC 75 ms 7.40 MiB
near_arg_00 AC 77 ms 7.27 MiB
near_arg_01 AC 77 ms 7.25 MiB
near_arg_02 AC 77 ms 7.27 MiB
near_arg_shuffle_00 AC 77 ms 7.27 MiB
near_arg_shuffle_01 AC 77 ms 7.27 MiB
near_arg_shuffle_02 AC 77 ms 7.27 MiB
only_x_axis_00 AC 1 ms 0.45 MiB
random_00 AC 47 ms 4.87 MiB
random_01 AC 57 ms 5.65 MiB
random_02 AC 20 ms 2.28 MiB
small_all_00 AC 1 ms 0.45 MiB

// An AC a day keeps the doctor away. #pragma GCC optimize("Ofast") #include <bits/stdc++.h> #ifdef local #define safe std::cerr<<__PRETTY_FUNCTION__<<" line "<<__LINE__<<" safe\n" #define debug(args...) qqbx(#args, args) #define orange(args...) danb(#args, args) using std::cerr; template <typename ...T> void qqbx(const char *s, T ...args) { int cnt = sizeof...(T); ((cerr << "\e[1;32m(" << s << ") = ("), ..., (cerr << args << (--cnt ? ", " : ")\e[0m\n"))); } template <typename T> void danb(const char *s, T L, T R) { cerr << "\e[1;32m[ " << s << " ] = [ "; for (int f = 0; L != R; ++L) cerr << (f++ ? ", " : "") << *L; cerr << " ]\e[0m\n"; } #else #define safe ((void)0) #define debug(...) ((void)0) #define orange(...) ((void)0) #endif // local #define all(v) begin(v),end(v) using namespace std; using coord_t = int64_t; using Point = complex<coord_t>; coord_t dot(Point a, Point b) { return real(conj(a) * b); } coord_t cross(Point a, Point b) { return imag(conj(a) * b); } int ori(Point a, Point b, Point c) { coord_t C = cross(b - a, c - a); return (C > 0) - (C < 0); } bool operator<(const Point &a, const Point &b) { return a.real() != b.real() ? a.real() < b.real() : a.imag() < b.imag(); } bool argCmp(Point a, Point b) { int qa = (imag(a) == 0 ? (real(a) < 0 ? 3 : 1) : (imag(a) < 0 ? 0 : 2)); int qb = (imag(b) == 0 ? (real(b) < 0 ? 3 : 1) : (imag(b) < 0 ? 0 : 2)); if (qa != qb) return qa < qb; return cross(a, b) > 0; } signed main() { ios_base::sync_with_stdio(0), cin.tie(0); int n; cin >> n; vector<Point> pt(n); for (int i = 0; i < n; i++) { int x, y; cin >> x >> y; pt[i] = { x, y }; } sort(all(pt), argCmp); for (int i = 0; i < n; i++) cout << pt[i].real() << ' ' << pt[i].imag() << '\n'; }