QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#532698#9227. Henry the Plumberucup-team1231#WA 18ms10808kbPython31.5kb2024-08-25 09:36:502024-08-25 09:36:50

Judging History

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

  • [2024-08-25 09:36:50]
  • 评测
  • 测评结果:WA
  • 用时:18ms
  • 内存:10808kb
  • [2024-08-25 09:36:50]
  • 提交

answer

def sub(a,b):
    return [p-q for p,q in zip(a,b)]
def dot(a,b):
    return sum([p*q for p,q in zip(a,b)])
def eq(a,b,e,c,d,f):
    return [[c*d-b*f,a*f-e*c],a*d-b*c]
def mul_scalar(a,b):
    return [x*b for x in a]
import copy
def gett(p,a,q,b,u,gg):
    gg = copy.deepcopy(gg)
    def swp(r):
        r[2], r[u] = r[u], r[2]
        return r
    gg = [swp(x) for x in gg]
    ans = []
    for Z in range(2):
        RHS1 = a-Z*p[-1]
        RHS2 = b-Z*q[-1]
        RS = eq(p[0],p[1],RHS1,q[0],q[1],RHS2)
        if RS[1] == 0:
            return None
        RS[0].append(RS[1]*Z)
        RS[0]=swp(RS[0])
        ans.append(RS)
    return ans
def solve():
    A = list(map(int, input().split()))
    p = list(map(int, input().split()))
    p.append(0)
    B = list(map(int, input().split()))
    q = list(map(int, input().split()))
    q.append(0)
    gg = [A,B,p,q]
    s = sub(B,A)
    if dot(p,s) == 0 and dot(s,q) == 0:
        return 2
    for u in range(3):
        w = gett(p,dot(A,p),q,dot(B,q),u,gg)
        if w is not None:
            break
    if w is None:
        return 4
    M = w[0][1]*w[1][1]
    w0 = mul_scalar(w[0][0],w[1][1])
    w1 = mul_scalar(w[1][0],w[0][1])
    P = w0
    S = sub(w1,w0)
    AA = dot(S,S)
    BB = dot(S,[p*2-(a+b)*M for p,a,b in zip(P,A,B)])
    CC = dot([p-a*M for p,a in zip(P,A)],[p-b*M for p,b in zip(P,B)])
    DELTA = BB*BB-4*AA*CC
    if DELTA<0:
        return 4
    return 3
T=int(input())
for _ in range(T):
    print(solve())

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 11ms
memory: 10808kb

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: -100
Wrong Answer
time: 18ms
memory: 10808kb

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
4
4
4
4
4
4
4
4
3
3
3
4
4
4
4
4
4
4
4
4
4
4
3
3
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
3
4
3
4
3
4
4
4
4
4
3
4
4
4
3
4
3
4
3
3
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
3
4
3
4
4
4
4
4
4
4
4
4

result:

wrong answer 7th numbers differ - expected: '3', found: '4'