QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#153298 | #6412. Classical Geometry Problem | Alleks_B | WA | 17ms | 3588kb | C++14 | 4.3kb | 2023-08-29 21:04:59 | 2023-08-29 21:04:59 |
Judging History
answer
#include <bits/stdc++.h>
#define INVALID -1
#define EPS 0.000000000001
using namespace std;
int t;
int a, b, c;
double x_ab, y_ab, y_bc, z_bc, z_ca, x_ca, x_a, y_b, z_c;
void solve() {
cin >> a >> b >> c;
cout << "3\n";
cout << fixed << setprecision(8);
x_ab = y_ab = y_bc = z_bc = z_ca = x_ca = INVALID;
if (c != 255) {
x_ab = (double)c * (255 - a) / (c - 255) + a;
y_ab = (double)c * (255 - b) / (c - 255) + b;
}
if (a != 255) {
y_bc = (double)a * (255 - b) / (a - 255) + b;
z_bc = (double)a * (255 - c) / (a - 255) + c;
}
if (b != 255) {
z_ca = (double)b * (255 - c) / (b - 255) + c;
x_ca = (double)b * (255 - a) / (b - 255) + a;
}
x_ab = (x_ab < 0 ? INVALID : x_ab);
y_ab = (y_ab < 0 ? INVALID : y_ab);
y_bc = (y_bc < 0 ? INVALID : y_bc);
z_bc = (z_bc < 0 ? INVALID : z_bc);
z_ca = (z_ca < 0 ? INVALID : z_ca);
x_ca = (x_ca < 0 ? INVALID : x_ca);
if (a == 255 && b == 255 && c == 255)
x_ab = y_ab = 255;
if (abs(x_ab - INVALID) > EPS && abs(y_ab - INVALID) > EPS) {
x_a = y_b = INVALID;
if (abs(y_ab - 255) > EPS)
x_a = y_ab * (255 - x_ab) / (y_ab - 255) + x_ab;
if (abs(x_ab - 255) > EPS)
y_b = x_ab * (255 - y_ab) / (x_ab - 255) + y_ab;
x_a = (x_a < 0 ? INVALID : x_a);
y_b = (y_b < 0 ? INVALID : y_b);
if (abs(y_ab - 255) < EPS && abs(x_ab - 255) < EPS)
x_a = 255;
if (abs(x_a - INVALID) > EPS) {
int q = x_a;
if (abs(q - INVALID) < EPS)
x_a = 100000 + c;
cout << "255 0 0 " << x_a << "\n";
cout << "255 255 0 " << sqrt((x_a - x_ab) * (x_a - x_ab) + y_ab * y_ab) << "\n";
cout << "255 255 255 " << sqrt((x_ab - a) * (x_ab - a) + (y_ab - b) * (y_ab - b) + c * c) << "\n";
}
else {
int q = y_b;
if (abs(q - INVALID) < EPS)
y_b = 100000 + c;
cout << "0 255 0 " << y_b << "\n";
cout << "255 255 0 " << sqrt((y_b - y_ab) * (y_b - y_ab) + x_ab * x_ab) << "\n";
cout << "255 255 255 " << sqrt((x_ab - a) * (x_ab - a) + (y_ab - b) * (y_ab - b) + c * c) << "\n";
}
}
else if (abs(y_bc - INVALID) > EPS && abs(z_bc - INVALID) > EPS) {
y_b = z_c = INVALID;
if (abs(z_bc - 255) > EPS)
y_b = z_bc * (255 - y_bc) / (z_bc - 255) + y_bc;
if (abs(y_bc - 255) > EPS)
z_c = y_bc * (255 - z_bc) / (y_bc - 255) + z_bc;
y_b = (y_b < 0 ? INVALID : y_b);
z_c = (z_c < 0 ? INVALID : z_c);
if (abs(z_bc - 255) < EPS && abs(y_bc - 255) < EPS)
y_b = 255;
if (abs(y_b - INVALID) > EPS) {
int q = y_b;
if (abs(q - INVALID) < EPS)
y_b = 100000 + c;
cout << "0 255 0 " << y_b << "\n";
cout << "0 255 255 " << sqrt((y_b - y_bc) * (y_b - y_bc) + z_bc * z_bc) << "\n";
cout << "255 255 255 " << sqrt((y_bc - b) * (y_bc - b) + (z_bc - c) * (z_bc - c) + a * a) << "\n";
}
else {
int q = z_c;
if (abs(q - INVALID) < EPS)
z_c = 100000 + c;
cout << "0 0 255 " << z_c << "\n";
cout << "0 255 255 " << sqrt((z_c - z_bc) * (z_c - z_bc) + y_bc * y_bc) << "\n";
cout << "255 255 255 " << sqrt((y_bc - b) * (y_bc - b) + (z_bc - c) * (z_bc - c) + a * a) << "\n";
}
}
else {
z_c = x_a = INVALID;
if (abs(x_ca - 255) > EPS)
z_c = x_ca * (255 - z_ca) / (x_ca - 255) + z_ca;
if (abs(z_ca - 255) > EPS)
x_a = z_ca * (255 - x_ca) / (z_ca - 255) + x_ca;
z_c = (z_c < 0 ? INVALID : z_c);
x_a = (x_a < 0 ? INVALID : x_a);
if (abs(x_ca - 255) < EPS && abs(z_ca - 255) < EPS)
z_c = 255;
if (abs(z_c - INVALID) > EPS) {
int q = z_c;
if (abs(q - INVALID) < EPS)
z_c = 100000 + c;
cout << "0 0 255 " << z_c << "\n";
cout << "255 0 255 " << sqrt((z_c - z_ca) * (z_c - z_ca) + x_ca * x_ca) << "\n";
cout << "255 255 255 " << sqrt((z_ca - c) * (z_ca - c) + (x_ca - a) * (x_ca - a) + b * b) << "\n";
}
else {
int q = x_a;
if (abs(q - INVALID) < EPS)
x_a = 100000 + c;
cout << "255 0 0 " << x_a << "\n";
cout << "255 0 255 " << sqrt((x_a - x_ca) * (x_a - x_ca) + z_ca * z_ca) << "\n";
cout << "255 255 255 " << sqrt((z_ca - c) * (z_ca - c) + (x_ca - a) * (x_ca - a) + b * b) << "\n";
}
}
}
int main(){
for (cin >> t; t; t--)
solve();
return 0;
}
詳細信息
Test #1:
score: 100
Accepted
time: 0ms
memory: 3588kb
input:
3 105 255 175 174 174 174 0 0 0
output:
3 0 255 0 255.00000000 0 255 255 119.00000000 255 255 255 119.00000000 3 255 0 0 0.00000000 255 255 0 0.00000000 255 255 255 301.37684052 3 255 0 0 0.00000000 255 255 0 0.00000000 255 255 255 0.00000000
result:
ok ok (3 test cases)
Test #2:
score: -100
Wrong Answer
time: 17ms
memory: 3568kb
input:
10000 250 128 13 1 245 2 88 183 138 179 69 194 153 246 33 255 119 192 233 30 108 26 208 33 53 162 189 225 130 10 202 137 121 152 198 25 49 165 180 228 56 30 74 18 14 6 115 31 168 242 206 90 238 139 44 103 60 16 21 190 229 209 68 41 171 181 39 74 73 181 96 18 234 95 70 75 174 84 101 16 44 202 249 80 ...
output:
3 255 0 0 244.96062992 255 255 0 121.27156248 255 255 255 14.68387252 3 0 255 0 244.92094862 0 255 255 1.00472092 255 255 255 1.41198140 3 0 255 0 98.07692308 0 255 255 89.64546449 255 255 255 113.94958289 3 0 0 255 50.32894737 255 0 255 193.37465331 255 255 255 77.89704277 3 0 255 0 232.50000000 25...
result:
wrong answer Double parameter [name=d[1]] equals to 100246, violates the range [0, 10000] (test case 505)