(polys, idx, ys, st, y, cur, buf)
| 12 | return round((p1[0]+k*p2[0])/(1+k),4) |
| 13 | |
| 14 | def scan(polys, idx, ys, st, y, cur, buf): |
| 15 | while cur<len(idx) and ys[st[cur]]<=y: |
| 16 | c = idx[st[cur]] |
| 17 | poly = polys[c[0]] |
| 18 | for i in (c[0], (c[1]-1)%len(poly)), tuple(c): |
| 19 | if i in buf:buf.remove(i) |
| 20 | else: buf.append(i) |
| 21 | cur += 1 |
| 22 | return cur |
| 23 | |
| 24 | def roots(polys, buf, y): |
| 25 | rs = [] |