QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#702851 | #6639. Disk Tree | stavage | WA | 3ms | 13376kb | C++20 | 2.1kb | 2024-11-02 16:40:52 | 2024-11-02 16:40:53 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
typedef long double LD;
#define int LL
#define double LD
const int N = 2e5 + 5;
const double eps = 1e-8;
const double PI = acosl(-1);
struct Point {
double x, y;
Point(double x = 0, double y = 0) : x(x), y(y) {}
};
typedef Point Vector;
Point operator+(Point a, Point b) { return Point(a.x + b.x, a.y + b.y); }
Point operator-(Point a, Point b) { return Point(a.x - b.x, a.y - b.y); }
Point operator*(Point a, double p) { return Point(a.x * p, a.y * p); }
Point operator/(Point a, double p) { return Point(a.x / p, a.y / p); }
bool operator<(const Point &a, const Point &b) { return a.x < b.x || (a.x == b.x && a.y < b.y); }
int sgn(double x)
{
if (fabs(x) < eps) return 0;
if (x < 0) return -1;
return 1;
}
bool operator==(const Point &a, const Point &b) { return !sgn(a.x - b.x) && !sgn(a.y - b.y); }
struct Circle {
Point c;
double r;
Circle(Point c = Point(), double r = 0) : c(c), r(r) {}
inline Point point(double a)
{
return Point(c.x + cos(a) * r, c.y * sin(a) * r);
}
bool operator<(const Circle a) const { return c < a.c; }
};
inline Circle read_circle()
{
Circle c;
cin >> c.c.x >> c.c.y >> c.r;
return c;
}
double xmult(Point p1, Point p2, Point p0)
{
return (p1.x - p0.x) * (p2.y - p0.y) - (p2.x - p0.x) * (p1.y - p0.y);
}
Circle c[N];
void solve()
{
int f = -1;
int n;
cin >> n;
for (int i = 0; i < n; i++) {
c[i] = read_circle();
// if (c[i].c.x - c[i].r < 0) f = 1;
// else if (c[i].c.x + c[i].r > 1e9)
// f = 0;
}
// if (!f) {
// cout << "NO\n";
// return;
// }
cout << "YES\n";
sort(c, c + n);
for (int i = 1; i < n; i++) {
cout << c[i - 1].c.x << " " << c[i - 1].c.y << " " << c[i].c.x << " " << c[i].c.y << "\n";
}
}
signed main()
{
cin.tie(nullptr)->ios::sync_with_stdio(false);
cout << fixed << setprecision(0);
int _ = 1;
while (_--) {
solve();
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 13376kb
input:
3 1 0 3 10 10 6 0 5 1
output:
YES 0 5 1 0 1 0 10 10
result:
ok answer = 1
Test #2:
score: 0
Accepted
time: 3ms
memory: 13116kb
input:
2 1 1 1 3 3 1
output:
YES 1 1 3 3
result:
ok answer = 1
Test #3:
score: -100
Wrong Answer
time: 0ms
memory: 13372kb
input:
5 10 10 10 2 0 1 20 20 1 3 20 1 20 0 1
output:
YES 2 0 3 20 3 20 10 10 10 10 20 0 20 0 20 20
result:
wrong answer Two line segments intersect, and it's not only the endpoints that intersect or line segments intersects/touches more than 2 disks