QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#101567 | #6378. LaLa and Monster Hunting (Part 1) | zhoukangyang# | WA | 3ms | 4000kb | C++17 | 1.4kb | 2023-04-30 11:50:20 | 2023-04-30 11:50:25 |
Judging History
answer
#include<bits/stdc++.h>
#define L(i, j, k) for(int i = (j); i <= (k); ++i)
#define R(i, j, k) for(int i = (j); i >= (k); --i)
#define ll long long
#define vi vector <int>
#define sz(a) ((int) (a).size())
#define me(f, x) memset(f, x, sizeof(f))
#define uint unsigned int
#define ull unsigned long long
#define bs bitset < N >
using namespace std;
const int N = 1e6 + 7;
const double pi = acos(-1);
int n, m;
double x[N], y[N], r[N];
vector < double > point;
inline void pb(double x) {
// cout << "x = " << x << endl;
while(x < 0) x += pi * 2;
while(x >= pi * 2) x -= pi * 2;
point.emplace_back(x);
}
void solve(double x, double y, double r) {
double rotate = atan2(x, y);
double nx = x * cos(rotate) - y * sin(rotate);
double ny = x * sin(rotate) + y * cos(rotate);
x = nx;
y = ny;
// cout << r << ' ' << ny << endl;
double t = cos(r / ny);
pb(rotate - t);
pb(rotate + t);
}
int main() {
ios :: sync_with_stdio(false);
cin.tie(0); cout.tie(0);
cin >> n;
L(i, 1, n) {
cin >> x[i] >> y[i] >> r[i];
if(x[i] * x[i] + y[i] * y[i] <= r[i] * r[i]) {
cout << "Yes\n";
return 0;
}
solve(x[i], y[i], r[i]);
}
sort(point.begin(), point.end());
L(i, 0, sz(point) - 2) {
if(point[i + 1] - point[i] > pi) {
cout << "No\n";
return 0;
}
}
if(point.back() - point[0] < pi) {
cout << "No\n";
} else {
cout << "Yes\n";
}
return 0;
}
详细
Test #1:
score: 100
Accepted
time: 2ms
memory: 3932kb
input:
3 -3 0 1 0 0 3 3 0 1
output:
Yes
result:
ok answer is YES
Test #2:
score: 0
Accepted
time: 2ms
memory: 3980kb
input:
3 2 0 1 0 2 1 -5 -5 3
output:
Yes
result:
ok answer is YES
Test #3:
score: 0
Accepted
time: 2ms
memory: 3940kb
input:
1 3 3 1
output:
No
result:
ok answer is NO
Test #4:
score: 0
Accepted
time: 1ms
memory: 3560kb
input:
1 -3 -2 5
output:
Yes
result:
ok answer is YES
Test #5:
score: 0
Accepted
time: 2ms
memory: 3496kb
input:
2 1 3 5 -2 -6 1
output:
Yes
result:
ok answer is YES
Test #6:
score: 0
Accepted
time: 2ms
memory: 3904kb
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: 3552kb
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: 3472kb
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: 2ms
memory: 3568kb
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: 2ms
memory: 3496kb
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: 3ms
memory: 3496kb
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: 2ms
memory: 3564kb
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: 1ms
memory: 3556kb
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: 2ms
memory: 3628kb
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: 1ms
memory: 3492kb
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: 3ms
memory: 3500kb
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: 3ms
memory: 3552kb
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: 2ms
memory: 3492kb
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: 2ms
memory: 3556kb
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: 3556kb
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: 2ms
memory: 3976kb
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: 2ms
memory: 3536kb
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: 3572kb
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: 3888kb
input:
3 -6 -6 2 -10 -8 8 -7 -7 5
output:
No
result:
ok answer is NO
Test #25:
score: -100
Wrong Answer
time: 2ms
memory: 4000kb
input:
4 -7 -9 3 -3 -6 2 9 -1 2 0 -7 3
output:
Yes
result:
wrong answer expected NO, found YES