QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#697797 | #6412. Classical Geometry Problem | tassei903# | WA | 144ms | 10784kb | Python3 | 1.8kb | 2024-11-01 15:48:33 | 2024-11-01 15:48:33 |
Judging History
answer
def norm(a, b, c):
return (a**2+b**2+c**2)**0.5
eps = 10 ** -9
def solve(a, b, c):#a,b,c <= 1/2
ans = []
d = min(a, b, c)
dd = d / (1-d)
ans.append((1, 1, 1, dd * norm(1-a,1-b,1-c)))
a,b,c = a - (1-a) * dd,b - (1-b) * dd,c - (1-c) * dd
dd = a / (1 - a)
ans.append((1, 0, 0, dd * norm(1-a, b, c)))
a, b, c = a - (1 - a) * dd, b + b * dd, c + c * dd
#print(a, b, c)
dd = b / (1 - b)
ans.append((0, 1, 0, dd * norm(a, 1-b, c)))
a, b, c = a + a * dd, b - (1 - b) * dd, c + c * dd
dd = c / (1 - c)
ans.append((0, 0, 1, dd * norm(a, b, 1-c)))
a, b, c = a + a * dd, b + b * dd, c - (1 - c) * dd
assert max(abs(a), abs(b), abs(c)) <= 10 ** -8
return ans[::-1]
def check(ans, A,B,C):
x,y,z = 0, 0, 0
for r,g,b, t in ans:
v = norm(r-x,g-y,b-z)
x = x + (r - x) * t / v
y = y + (g - y) * t / v
z = z + (b - z) * t / v
# print(x, y, z)
# print(max(abs(x-a), abs(b-y), abs(c-z)))
return max(abs(x-A), abs(B-y), abs(C-z)) <= 10 ** -6
m = 255
for _ in range(int(input())):
a,b,c = map(int, input().split())
A,B,C = a/m, b/m, c/m
# print(A, B, C)
flag = [0,0,0]
ans = []
if m - a < a:
flag[0] = 1
a = m - a
ans.append((*flag, 1))
if m - b < b:
flag[1] = 1
b = m - b
ans.append((*flag, 1))
if m - c < c:
flag[2] = 1
c = m - c
ans.append((*flag, 1))
# print(flag)
ans += [(r^flag[0], flag[1]^g, b^flag[2], t) for r,g,b,t in solve(a/m, b/m, c/m)]
print(len(ans))
for r,g,b, t in ans:
# print(r,g,b,t)
print(r * m, g * m, b * m, t * m)
assert check(ans, A,B,C)
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 15ms
memory: 10640kb
input:
3 105 255 175 174 174 174 0 0 0
output:
6 0 255 0 255 0 255 255 255 0 255 0 136.0 0 0 255 0.0 255 255 255 119.0 255 0 0 0.0 7 255 0 0 255 255 255 0 255 255 255 255 255 255 255 0 0.0 255 0 255 0.0 0 255 255 0.0 0 0 0 140.29611541307906 4 0 0 255 0.0 0 255 0 0.0 255 0 0 0.0 255 255 255 0.0
result:
ok ok (3 test cases)
Test #2:
score: -100
Wrong Answer
time: 144ms
memory: 10784kb
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:
6 255 0 0 255 255 255 0 255 255 255 255 15.9375 255 0 0 124.68280998698256 0 255 0 0.0 0 0 255 7.414796018772195 5 0 255 0 255 0 255 255 1.0408163265306123 0 0 0 9.0355083344683 255 255 0 0.0 255 0 255 1.709541121196472 6 0 255 0 255 0 255 255 255 0 255 0 68.71257485029939 0 0 255 0.0 255 255 255 23...
result:
wrong answer Double parameter [name=d[3]] equals to -8.02964e-15, violates the range [0, 10000] (test case 4)