QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#796602 | #6378. LaLa and Monster Hunting (Part 1) | karuna | WA | 1ms | 4352kb | C++20 | 1.7kb | 2024-12-01 21:55:03 | 2024-12-01 21:55:03 |
Judging History
answer
#include <bits/stdc++.h>
#define ff first
#define ss second
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef double ld;
const ld eps = 1e-9;
struct point {
ld x, y;
};
point operator+(point a, point b) { return {a.x + b.x, a.y + b.y}; }
point operator-(point a, point b) { return {a.x - b.x, a.y - b.y}; }
ld operator*(point a, point b) { return a.x * b.x + a.y * b.y; }
ld operator/(point a, point b) { return a.x * b.y - a.y * b.x; }
point operator*(ld k, point a) { return {k * a.x, k * a.y}; }
point unit(point a) { return 1 / sqrt(a * a) * a; }
point rotate(point a, ld theta) {
ld c = cos(theta);
ld s = sin(theta);
return {a.x * c - a.y * s, a.x * s + a.y * c};
}
int ccw(point p, point q, point r) {
ld x = (q - p) / (r - p);
return (x > eps) - (x < -eps);
}
int main() {
cin.tie(0); ios_base::sync_with_stdio(0);
int n;
cin >> n;
point a[n]; ld r[n];
for (int i = 0; i < n; i++) {
cin >> a[i].x >> a[i].y >> r[i];
if (a[i] * a[i] <= r[i] * r[i]) {
return !(cout << "Yes\n");
}
}
vector<point> vec;
for (int i = 0; i < n; i++) {
ld theta = asin(r[i] / sqrt(a[i] * a[i] - r[i] * r[i]));
point u = unit(a[i]);
vec.push_back(rotate(u, theta));
vec.push_back(rotate(u, -theta));
}
auto sgn = [&](point p) {
return abs(p.y) < eps ? p.x > 0 : p.y > 0;
};
sort(vec.begin(), vec.end(), [&](point p, point q) {
int b = sgn(p);
int c = sgn(q);
return b == c ? p / q > 0 : b;
});
for (int i = 0; i < vec.size(); i++) {
int j = (i + 1) % vec.size();
if (vec[i] / vec[j] < eps) return !(cout << "No\n");
}
cout << "Yes\n";
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3756kb
input:
3 -3 0 1 0 0 3 3 0 1
output:
Yes
result:
ok answer is YES
Test #2:
score: 0
Accepted
time: 0ms
memory: 4192kb
input:
3 2 0 1 0 2 1 -5 -5 3
output:
Yes
result:
ok answer is YES
Test #3:
score: 0
Accepted
time: 0ms
memory: 4164kb
input:
1 3 3 1
output:
No
result:
ok answer is NO
Test #4:
score: 0
Accepted
time: 0ms
memory: 3764kb
input:
1 -3 -2 5
output:
Yes
result:
ok answer is YES
Test #5:
score: 0
Accepted
time: 0ms
memory: 3964kb
input:
2 1 3 5 -2 -6 1
output:
Yes
result:
ok answer is YES
Test #6:
score: 0
Accepted
time: 0ms
memory: 3836kb
input:
3 -14 7 7 2 -1 3 8 -1 9
output:
Yes
result:
ok answer is YES
Test #7:
score: 0
Accepted
time: 0ms
memory: 3852kb
input:
4 5 -3 9 -10 6 5 4 2 2 -8 10 2
output:
Yes
result:
ok answer is YES
Test #8:
score: 0
Accepted
time: 0ms
memory: 3700kb
input:
5 -2 -1 4 9 10 5 -9 2 4 6 -3 5 0 -4 10
output:
Yes
result:
ok answer is YES
Test #9:
score: 0
Accepted
time: 0ms
memory: 3716kb
input:
6 -3 -1 6 3 1 8 1 2 4 1 -3 5 3 7 4 5 5 4
output:
Yes
result:
ok answer is YES
Test #10:
score: 0
Accepted
time: 0ms
memory: 3744kb
input:
7 3 -2 5 -1 10 7 -1 10 3 1 -5 5 -9 -9 4 -5 -10 5 1 4 9
output:
Yes
result:
ok answer is YES
Test #11:
score: 0
Accepted
time: 0ms
memory: 3828kb
input:
8 3 -1 5 1 7 2 -2 -10 6 -1 6 4 -2 0 9 0 9 6 -7 1 7 5 -2 7
output:
Yes
result:
ok answer is YES
Test #12:
score: 0
Accepted
time: 0ms
memory: 3716kb
input:
9 -1 0 8 2 0 8 -8 -10 2 8 -2 1 -5 -8 0 -2 -3 5 -7 -4 9 -3 9 8 -10 10 7
output:
Yes
result:
ok answer is YES
Test #13:
score: 0
Accepted
time: 0ms
memory: 3708kb
input:
10 -3 0 4 3 -1 8 7 0 6 -6 -10 2 4 5 2 -7 -5 0 -7 4 7 10 7 0 -3 0 9 7 -6 6
output:
Yes
result:
ok answer is YES
Test #14:
score: 0
Accepted
time: 0ms
memory: 3736kb
input:
11 0 -4 7 5 9 4 -8 0 2 -10 8 5 7 9 1 7 8 8 4 -8 5 8 6 9 2 -7 8 3 4 0 10 -8 10
output:
Yes
result:
ok answer is YES
Test #15:
score: 0
Accepted
time: 0ms
memory: 3900kb
input:
12 2 3 5 -5 -9 5 5 -10 3 9 -10 9 -4 -10 0 10 5 1 -3 -5 7 2 10 10 0 7 10 -10 -7 5 -7 1 9 0 4 8
output:
Yes
result:
ok answer is YES
Test #16:
score: 0
Accepted
time: 0ms
memory: 3760kb
input:
13 3 0 5 -12 0 4 2 2 8 6 3 4 5 -3 0 3 -4 9 -9 5 9 -1 -3 5 4 -1 2 1 -3 10 -10 2 3 -7 9 7 -6 9 3
output:
Yes
result:
ok answer is YES
Test #17:
score: 0
Accepted
time: 0ms
memory: 3828kb
input:
14 2 1 4 8 -3 0 -7 -4 2 10 -6 5 -4 -4 4 1 1 2 4 6 5 -3 -5 5 10 -10 1 4 -6 2 -4 9 3 -3 10 8 -6 6 10 8 -8 1
output:
Yes
result:
ok answer is YES
Test #18:
score: 0
Accepted
time: 0ms
memory: 3712kb
input:
15 1 2 6 -1 -2 3 9 -10 2 0 5 6 8 10 8 -2 -6 9 -7 4 0 6 -10 1 -6 -3 10 7 -3 2 5 -9 5 10 0 3 9 -6 1 0 -1 3 -8 -3 5
output:
Yes
result:
ok answer is YES
Test #19:
score: 0
Accepted
time: 0ms
memory: 3780kb
input:
16 0 -8 9 1 -4 0 -8 -3 7 -6 -7 7 3 -7 9 -9 7 10 4 1 1 -9 2 7 1 -7 7 -5 -3 3 4 4 3 -1 -9 2 -4 -1 7 -8 -2 10 -6 1 3 -1 -8 3
output:
Yes
result:
ok answer is YES
Test #20:
score: 0
Accepted
time: 0ms
memory: 3748kb
input:
17 0 4 7 -6 8 0 6 6 4 3 -8 7 -6 2 6 -10 8 3 -10 9 8 -9 1 9 -10 8 2 -9 0 7 -5 1 1 2 -4 5 -3 -5 0 -4 0 6 1 -2 0 6 -4 4 -2 -7 3
output:
Yes
result:
ok answer is YES
Test #21:
score: 0
Accepted
time: 0ms
memory: 3680kb
input:
18 -3 -3 1 5 5 8 7 -6 8 -10 3 4 10 1 2 7 -10 10 3 -4 9 1 5 6 -10 -4 1 3 -4 2 4 -5 9 3 -6 4 3 1 7 9 -3 5 6 9 8 5 -6 2 9 -2 5 10 3 2
output:
Yes
result:
ok answer is YES
Test #22:
score: 0
Accepted
time: 0ms
memory: 3652kb
input:
19 4 -1 8 -5 5 1 -5 -4 7 -9 -10 7 -8 6 0 10 10 6 2 -6 9 1 1 6 -9 -6 7 -8 -5 5 2 -7 9 1 -1 4 -7 4 5 -3 3 10 1 6 6 2 4 6 -7 3 10 -5 -4 8 9 -4 6
output:
Yes
result:
ok answer is YES
Test #23:
score: 0
Accepted
time: 0ms
memory: 3828kb
input:
20 1 0 2 -10 3 7 9 -3 7 0 -10 7 7 -6 8 -5 6 7 5 6 5 7 8 8 -4 -10 9 -8 -10 8 2 -5 5 -5 -5 9 -5 9 10 1 9 1 -7 6 4 0 -1 6 -5 7 9 -1 -4 5 -4 4 6 3 6 2
output:
Yes
result:
ok answer is YES
Test #24:
score: 0
Accepted
time: 0ms
memory: 4064kb
input:
3 -6 -6 2 -10 -8 8 -7 -7 5
output:
No
result:
ok answer is NO
Test #25:
score: 0
Accepted
time: 0ms
memory: 4288kb
input:
4 -7 -9 3 -3 -6 2 9 -1 2 0 -7 3
output:
No
result:
ok answer is NO
Test #26:
score: 0
Accepted
time: 0ms
memory: 4216kb
input:
5 2 -6 3 -2 -8 2 -3 -5 1 -5 -9 1 0 -7 1
output:
No
result:
ok answer is NO
Test #27:
score: 0
Accepted
time: 0ms
memory: 4352kb
input:
6 10 9 6 7 10 3 6 10 8 3 7 3 -4 8 3 7 5 4
output:
No
result:
ok answer is NO
Test #28:
score: 0
Accepted
time: 0ms
memory: 4012kb
input:
7 -9 8 6 -8 1 4 -10 -1 1 -7 10 4 -5 9 1 -8 10 6 -10 9 5
output:
No
result:
ok answer is NO
Test #29:
score: 0
Accepted
time: 0ms
memory: 4120kb
input:
8 0 -8 3 9 -10 7 5 -7 1 4 -7 2 3 -7 5 0 -5 1 3 -7 2 2 -7 4
output:
No
result:
ok answer is NO
Test #30:
score: 0
Accepted
time: 0ms
memory: 4232kb
input:
9 -1 -9 3 7 -7 2 10 0 1 -8 -10 2 -5 -10 1 8 -4 2 8 -9 5 8 -5 4 8 -7 3
output:
No
result:
ok answer is NO
Test #31:
score: 0
Accepted
time: 0ms
memory: 4016kb
input:
10 -7 -8 1 -7 -9 3 -7 1 1 -7 -1 1 -6 3 2 -10 6 3 -10 -9 2 -6 2 1 -8 -9 3 -5 -3 1
output:
No
result:
ok answer is NO
Test #32:
score: 0
Accepted
time: 0ms
memory: 4120kb
input:
11 -7 -3 4 1 -10 3 -10 -5 5 -7 -7 4 -10 2 1 0 -8 1 -4 -4 2 -10 -3 3 -6 -7 5 -6 -8 3 2 -10 2
output:
No
result:
ok answer is NO
Test #33:
score: 0
Accepted
time: 0ms
memory: 4332kb
input:
12 -8 10 4 -8 8 5 -9 8 3 -9 9 6 1 7 3 -6 8 7 1 9 2 1 7 2 -6 8 3 -7 0 1 -3 6 4 2 10 2
output:
No
result:
ok answer is NO
Test #34:
score: 0
Accepted
time: 0ms
memory: 4228kb
input:
13 -7 -1 1 -6 3 4 -9 8 7 1 9 1 -10 9 7 -5 9 6 -1 10 4 -5 4 4 -8 7 1 0 6 1 -9 0 4 -1 6 1 -8 10 5
output:
No
result:
ok answer is NO
Test #35:
score: 0
Accepted
time: 0ms
memory: 4288kb
input:
14 -8 -6 1 -9 -6 2 -6 3 3 -10 7 7 -7 9 8 -6 6 2 -10 5 9 -7 -1 3 0 8 1 -9 10 9 -10 -10 1 -6 5 4 -10 7 6 -2 8 1
output:
No
result:
ok answer is NO
Test #36:
score: 0
Accepted
time: 0ms
memory: 4296kb
input:
15 9 7 5 9 10 6 9 1 4 9 4 7 10 7 2 10 0 1 9 9 9 9 10 5 8 4 5 9 -2 4 7 -2 3 9 7 3 3 1 1 7 9 1 7 4 5
output:
No
result:
ok answer is NO
Test #37:
score: 0
Accepted
time: 0ms
memory: 4192kb
input:
16 -8 10 5 -9 10 2 -10 -2 2 -8 1 2 -5 -5 2 -10 1 6 -6 9 2 -8 4 1 -7 -5 4 -7 5 2 -9 -8 2 -10 -9 2 -8 -8 4 -8 -1 5 -6 -9 2 -7 5 1
output:
No
result:
ok answer is NO
Test #38:
score: 0
Accepted
time: 0ms
memory: 4148kb
input:
17 -8 -8 2 -10 3 5 -3 -7 2 -6 -6 5 -8 0 4 -2 -10 3 -9 -9 1 -9 -5 2 -9 4 3 -8 -3 2 -7 -6 1 -8 3 3 -5 -8 2 -6 -2 1 -6 1 2 -10 5 3 -5 -2 1
output:
No
result:
ok answer is NO
Test #39:
score: 0
Accepted
time: 1ms
memory: 4192kb
input:
18 4 -2 1 7 -10 1 9 -6 2 7 9 5 9 8 6 9 2 4 10 3 4 7 9 7 8 7 5 6 1 1 4 -2 1 9 0 4 7 10 7 5 3 3 2 7 2 4 6 3 10 -5 5 8 0 4
output:
No
result:
ok answer is NO
Test #40:
score: -100
Wrong Answer
time: 0ms
memory: 4128kb
input:
19 -2 10 4 10 9 2 -4 7 3 1 8 4 -7 2 2 -10 3 2 5 6 1 -3 10 6 -7 7 5 -2 10 8 -10 8 4 -3 5 3 -3 9 2 4 8 4 7 8 3 -8 4 1 4 10 1 9 7 1 -2 6 2
output:
Yes
result:
wrong answer expected NO, found YES