Submit Info #52726

Problem Lang User Status Time Memory
Sort Points by Argument cpp-acl dutinmeow AC 518 ms 7.72 MiB

ケース詳細
Name Status Time Memory
example_00 AC 2 ms 3.71 MiB
max_random_00 AC 504 ms 7.72 MiB
max_random_01 AC 513 ms 7.71 MiB
max_random_02 AC 513 ms 7.72 MiB
near_arg_00 AC 518 ms 7.59 MiB
near_arg_01 AC 518 ms 7.59 MiB
near_arg_02 AC 510 ms 7.59 MiB
near_arg_shuffle_00 AC 507 ms 7.58 MiB
near_arg_shuffle_01 AC 514 ms 7.58 MiB
near_arg_shuffle_02 AC 514 ms 7.59 MiB
only_x_axis_00 AC 2 ms 3.71 MiB
random_00 AC 316 ms 6.21 MiB
random_01 AC 375 ms 6.72 MiB
random_02 AC 124 ms 4.84 MiB
small_all_00 AC 2 ms 3.71 MiB

#include <bits/stdc++.h> using namespace std; using ll = long long; using ld = long double; using pii = pair<int, int>; using pll = pair<ll, ll>; #define FF first #define SS second #define MP make_pair #define PB push_back inline namespace geometry { template<typename T> struct Point { T x, y; Point() : x(0), y(0) {} Point(T x0, T y0) : x(x0), y(y0) {} Point& operator+=(const Point& p) { x += p.x; y += p.y; return *this; } Point& operator-=(const Point& p) { x -= p.x; y -= p.y; return *this; } Point& operator*=(const Point& p) { x *= p.x; y *= p.y; return *this; } Point& operator/=(const Point& p) { x /= p.x; y /= p.y; return *this; } Point operator+(const Point& p) const { return Point(*this) += p; } Point operator-(const Point& p) const { return Point(*this) -= p; } Point operator*(const Point& p) const { return Point(*this) *= p; } Point operator/(const Point& p) const { return Point(*this) /= p; } }; template<typename T> Point<T> operator+(T a, Point<T> p) { return p + a; } template<typename T> Point<T> operator*(T a, Point<T> p) { return p * a; } template<typename T> T dot(Point<T> p, Point<T> q) { return p.x * q.x + p.y * q.y; } template<typename T> T norm(Point<T> p) { return dot(p, p); } template<typename T> double abs(Point<T> p) { return sqrt(norm(p)); } template<typename T> double proj(Point<T> p, Point<T> q) { return dot(p, q) / abs(q); } template<typename T> double angle(Point<T> p, Point<T> q) { return acos(dot(p, q) / abs(p) / abs(q)); } template<typename T> T cross(Point<T> p, Point<T> q) { return p.x * q.y - p.y * q.x; } template<typename T> Point<T> intersect(Point<T> a1, Point<T> d1, Point<T> a2, Point<T> d2) { return a1 + cross(a2 - a1, d2) / cross(d1, d2) * d2; } template<typename T> bool operator==(const Point<T> &p, const Point<T> &q) { return p.x == q.x && p.y == q.y; } template<typename T> istream& operator>>(istream &is, Point<T> &p) { return is >> p.x >> p.y; } template<typename T> ostream& operator<<(ostream &os, const Point<T> &p) { return os << '(' << p.x << ',' << p.y << ')'; } } ld atan2(const Point<ll> &p) { if (p.x == 0 && p.y == 0) return 0.0; if (p.x < 0 && p.y == 0) return 3.14159265358979323846L; return atan2l(p.y, p.x); } int N; Point<ll> A[200005]; int main() { ios_base::sync_with_stdio(0); cin.tie(0); cin >> N; for (int i = 0; i < N; i++) cin >> A[i]; sort(A, A + N, [](const Point<ll> &p, const Point<ll> &q) { return atan2(p) < atan2(q); }); for (int i = 0; i < N; i++) cout << A[i].x << ' ' << A[i].y << '\n'; //cout << A[i] << ' ' << atan2(A[i]) << '\n'; }