QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#809712#9804. Guess the PolygonxumingyangRE 10ms10568kbPython3663b2024-12-11 16:55:202024-12-11 16:55:22

Judging History

This is the latest submission verdict.

  • [2024-12-11 16:55:22]
  • Judged
  • Verdict: RE
  • Time: 10ms
  • Memory: 10568kb
  • [2024-12-11 16:55:20]
  • Submitted

answer

def Gcd(a,b):
    if b==0: return a
    return Gcd(b,a%b)

T=int(input())
for _ in range(T):
    n=int(input())
    x=[0]*n
    y=[0]*n
    for i in range(n):
        x[i],y[i]=map(int,input().split())
    lasx,lasy=0,1
    A=0
    B=1
    x.sort()
    for i in range(1,n):
        if i<n-1:
            print("?",x[i],"1",flush=True)
            p,q=map(int,input().split())
        else:
            p,q=0,1
        xx = (lasx * q + lasy * p) * (x[i] - x[i - 1])
        yy = lasy * q
        A=B*xx+A*yy
        B=B*yy
        lasx = p
        lasy = q
    B=B*2
    g=Gcd(A,B)
    A=A//g
    B=B//g
    print("!",A,B,flush=True)

详细

Test #1:

score: 100
Accepted
time: 10ms
memory: 10568kb

input:

2
4
3 0
1 3
1 1
0 0
2 1
2 1
3
0 0
999 1000
1000 999
1999 1000

output:

? 1 1
? 1 1
! 3 1
? 999 1
! 1999 2

result:

ok correct! (2 test cases)

Test #2:

score: -100
Dangerous Syscalls

input:

9
4
1 1
1 3
3 0
0 0
3 1
3 1

output:

? 1 1
? 1 1
! 9 2

result: