QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#515812 | #9168. Square Locator | ucup-team3695 | WA | 192ms | 10692kb | Python3 | 809b | 2024-08-12 08:39:06 | 2024-08-12 08:39:06 |
Judging History
answer
a,b,c,d=map(int,input().split())
base=(0,int(round(a**0.5)))
def add(p,q):
return p[0]+q[0],p[1]+q[1]
def dist(q):
return q[0]**2+q[1]**2
def eval(x,y):
delt=(x,y)
rot=(y,-x)
return max(abs(dist(add(base,delt))-b),abs(dist(add(base,add(delt,rot)))-c),abs(dist(add(base,rot))-d))
def evalx(x):
loy=-10**9
hiy=10**9
for _ in range(200):
m1=loy+(hiy-loy)/3
m2=loy+2*(hiy-loy)/3
if eval(x,m1)<eval(x,m2):hiy=m2
else:loy=m1
y=(loy+hiy)/2
return eval(x,y),y
lox=-10**9
hix=10**9
for _ in range(200):
m1=lox+(hix-lox)/3
m2=lox+2*(hix-lox)/3
if evalx(m1)[0]<evalx(m2)[0]:hix=m2
else:lox=m1
x=int(round((lox+hix)/2))
score,y=evalx(x)
y=int(round(y))
A=base
B=add(base,(x,y))
C=add(base,(x+y,y-x))
D=add(base,(y,-x))
print(A[1],*B,*C,*D)
# print(score)
詳細信息
Test #1:
score: 100
Accepted
time: 182ms
memory: 10640kb
input:
36 5 10 41
output:
6 2 1 -3 -1 -5 4
result:
ok Answer is correct
Test #2:
score: 0
Accepted
time: 176ms
memory: 10688kb
input:
1 1 1 1
output:
1 0 1 0 1 0 1
result:
ok Answer is correct
Test #3:
score: 0
Accepted
time: 192ms
memory: 10584kb
input:
1000000000000000000 1000000000000000000 1000000000000000000 1000000000000000000
output:
1000000000 0 1000000000 0 1000000000 0 1000000000
result:
ok Answer is correct
Test #4:
score: 0
Accepted
time: 169ms
memory: 10640kb
input:
4 10 8 2
output:
2 1 3 2 2 1 1
result:
ok Answer is correct
Test #5:
score: -100
Wrong Answer
time: 180ms
memory: 10692kb
input:
4 50 104 58
output:
2 -5 -3 -10 2 -5 7
result:
wrong answer Squared distances are incorrect