QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#55078 | #2290. Kinking Cables | MIT01# | WA | 15ms | 8588kb | Python3 | 992b | 2022-10-12 09:09:40 | 2022-10-12 09:09:41 |
Judging History
answer
import sys
def dist(A, B):
return ((A[0]-B[0])**2 + (A[1]-B[1])**2) ** 0.5
n, m = map(int, input().split())
l = float(input())
goal = (n, m)
at = (0, 0)
far = 0
def get_pt(d, sign):
mid = (at[0] + goal[0]) / 2, (at[1] + goal[1]) / 2
perp = (at[1] - goal[1]), (goal[0] - at[0])
l = dist((0, 0), perp)
perp = perp[0]/l, perp[1]/l
return mid[0] + sign * d * perp[0], mid[1] + sign * d * perp[1]
def finish_off(sign):
lo, hi = 0, n + m
for i in range(100):
mid = (lo+hi) / 2
pt = get_pt(mid, sign)
if far + dist(at, pt) + dist(pt, goal) <= l:
lo = mid
else:
hi = mid
pt = get_pt(lo, sign)
print(*pt)
print(*goal)
def goto(dest, sign):
if far + dist(at, dest) + dist(dest, goal) <= l:
print(*dest)
return dest, far + dist(at, dest)
else:
finish_off(sign)
sys.exit(0)
for x in range(n+1):
at, far = goto((x, 0), -1)
at, far = goto((x, m), 1)
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 15ms
memory: 8588kb
input:
79 78 1980.7712136406
output:
0 0 0 78 1 0 1 78 2 0 2 78 3 0 3 78 4 0 4 78 5 0 5 78 6 0 6 78 7 0 7 78 8 0 8 78 9 0 9 78 10 0 10 78 11 0 11 78 12 0 32.13619845010919 50.479162869778 79 78
result:
wrong answer Integer parameter [name=p] equals to 0, violates the range [2, 500]