QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#697678#6412. Classical Geometry Problemtassei903#WA 12ms10680kbPython31.3kb2024-11-01 15:18:492024-11-01 15:18:49

Judging History

你现在查看的是最新测评结果

  • [2024-11-01 15:18:49]
  • 评测
  • 测评结果:WA
  • 用时:12ms
  • 内存:10680kb
  • [2024-11-01 15:18:49]
  • 提交

answer


def norm(a, b, c):
    return (a**2+b**2+c**2)**0.5



def solve(a, b, c):#a,b,c <= 1/2
    ans = []

    if a + b + c >= 1:
        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

    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]

m = 255

for _ in range(int(input())):
    a,b,c = map(int, input().split())
    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))
    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 * m, g * m, b * m, t * m)

详细

Test #1:

score: 0
Wrong Answer
time: 12ms
memory: 10680kb

input:

3
105 255 175
174 174 174
0 0 0

output:

5
0 255 0 255
0 255 255 255
0 255 0 24.000000000000007
0 0 255 0.0
255 255 255 119.0
6
255 0 0 255
255 255 0 255
255 255 255 255
255 255 0 34.43985947412319
255 0 255 44.189056734094095
0 255 255 96.97742054274721
3
0 0 255 0.0
0 255 0 0.0
255 0 0 0.0

result:

wrong answer too far from the target: (118.476417, 255.000000, 242.150722) instead of (105, 255, 175) (test case 1)