QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#630727 | #9227. Henry the Plumber | rikka_lyly | WA | 0ms | 3708kb | C++20 | 1.4kb | 2024-10-11 20:09:33 | 2024-10-11 20:09:34 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ull unsigned long long
#define EPS 1e-6
#define int ll
ll square(int x)
{
return x * x;
}
void solve()
{
int x1, y1, z1;
cin >> x1 >> y1 >> z1;
int p1, q1;
cin >> p1 >> q1;
int x2, y2, z2;
cin >> x2 >> y2 >> z2;
int p2, q2;
cin >> p2 >> q2;
if((x1 - x2) * p1 + (y1 - y2) * q1 == 0 && (x1 - x2) * p2 + (y1 - y2) * q2 == 0)
{
cout << 2 << '\n';
return;
}
double xc = (x1 + x2) / 2.0, yc = (y1 + y2) / 2.0;
double r = sqrt(square(x1 - x2) + square(y1 - y2) + square(z1 - z2)) / 2;
int b1 = x1 * p1 + y1 * q1, b2 = x2 * p2 + y2 * q2;
// cerr << b1 << " " << b2 << endl;
if(p1 * q2 == p2 * q1)
{
if(p1 * b2 != p2 * b1)
cout << 4 << '\n';
else
cout << 3 << '\n';
return;
}
double xp = 1.0 * (q2 * b1 - q1 * b2) / (p1 * q2 - p2 * q1);
double yp = 1.0 * (p2 * b1 - p1 * b2) / (q1 * p2 - q2 * p1);
if(hypot(xp - xc, yp - yc) < r - EPS || abs(hypot(xp - xc, yp - yc) - r) < EPS && !(z1 == z2 && (abs(xp - x1) < EPS && abs(yp - y1) < EPS || abs(xp - x2) < EPS && abs(yp - y2) < EPS)))
cout << 3 << '\n';
else
cout << 4 << '\n';
}
signed main()
{
ios::sync_with_stdio(false);
cin.tie(0), cout.tie(0);
int t;
cin >> t;
while (t--)
{
solve();
}
}
詳細信息
Test #1:
score: 100
Accepted
time: 0ms
memory: 3644kb
input:
2 -1 -1 3 1 1 2 2 3 2 2 5 5 1 3 0 7 6 -2 1 -2
output:
4 3
result:
ok 2 number(s): "4 3"
Test #2:
score: 0
Accepted
time: 0ms
memory: 3708kb
input:
100 -13 -5 -7 -19 19 -19 -13 0 -7 15 -20 20 19 -17 18 20 -20 -1 18 -19 -18 15 -14 -19 18 19 -20 6 20 -19 -12 9 1 7 -16 -13 -14 -8 8 -13 -19 16 9 20 -19 19 -18 -11 19 -18 19 20 -8 12 20 -11 -9 18 -19 -18 8 11 -13 12 -18 18 13 8 4 -18 -16 20 17 -19 18 20 -18 -3 20 -19 -17 -20 -5 -18 -19 19 16 15 19 20...
output:
4 4 4 4 4 4 3 4 4 4 3 4 4 3 3 4 3 4 4 4 4 4 4 4 4 4 4 4 3 3 3 4 4 4 4 4 4 4 4 4 4 4 4 4 3 4 4 4 4 4 3 4 3 4 4 4 3 4 4 4 4 4 4 4 3 4 3 4 4 4 4 4 4 4 4 4 4 4 4 3 4 4 4 4 4 4 4 3 3 4 3 4 4 4 4 4 4 4 4 4
result:
ok 100 numbers
Test #3:
score: -100
Wrong Answer
time: 0ms
memory: 3620kb
input:
100 20 -9 -19 9 13 -12 14 -18 -17 12 2 -3 -2 2 -19 -8 9 -15 -19 3 -16 -16 -18 2 15 19 17 -6 -10 11 14 -20 -6 -19 7 -17 -8 -1 -7 -15 7 -15 3 2 13 -15 -9 11 15 2 -17 20 13 11 -8 -12 18 16 -18 -17 -17 15 -2 -20 1 8 -6 0 -16 -19 -5 -14 16 -17 10 -7 -16 17 -10 -13 1 1 -13 17 11 -3 -3 -18 4 -17 19 -6 -17 ...
output:
3 4 3 3 3 3 3 3 3 3 3 3 4 4 3 3 4 3 3 4 4 3 3 3 3 4 4 3 3 4 4 3 3 3 3 3 3 3 3 4 3 3 3 4 3 4 3 3 3 3 3 4 3 3 4 3 3 4 3 3 3 4 4 3 4 3 3 4 3 3 3 3 3 3 3 4 3 3 3 4 3 3 3 3 3 4 3 3 3 3 3 3 3 4 3 3 4 4 3 4
result:
wrong answer 3rd numbers differ - expected: '4', found: '3'