QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#809712 | #9804. Guess the Polygon | xumingyang | RE | 10ms | 10568kb | Python3 | 663b | 2024-12-11 16:55:20 | 2024-12-11 16:55:22 |
Judging History
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