ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 1750. Pakhom and the Gully

hint
Posted by ASK 11 Apr 2018 21:31
Check: SBT; SAT, SABT, SBAT, SACT; the same four with swapped A and C

33
1 2 5 6 4 4 5 2 1 6
2 2 4 3 1 3 3 3 3 1
2 1 4 4 3 2 4 3 1 4
1 1 3 3 0 2 2 2 2 0
2 2 6 1 -1 1 5 6 5 0
2 2 0 3 -1 1 5 6 5 0
2 2 -4 0 -1 1 5 6 5 0
2 2 6 7 -1 1 5 6 5 0
2 2 5 7 -1 1 4 6 5 0
1 1 6 6 2 2 3 3 4 4
1 1 6 6 2 4 3 3 4 2
1 1 2 2 -1 -1 -1 -2 -2 -1
1 1 3 3 4 6 2 2 6 4
1 1 3 3 4 6 1 2 6 4
1 1 3 3 4 6 1 2 7 4
1 1 2 2 1 3 3 3 3 1
1 1 1 5 0 8 1 2 3 2
5 2 3 5 -1 2 4 5 6 3
4 1 5 5 2 3 6 4 5 2
1 1 7 5 2 3 6 4 5 2
1 1 3 3 2 4 2 2 4 2
6 1 6 4 0 5 7 2 6 5
2 2 4 2 2 1 3 6 4 1
4 2 2 2 2 1 3 6 4 1
8 7 1 3 6 1 7 4 0 9
5 1 2 2 2 1 4 1 8 9
9 -1 3 1 0 0 7 0 3 3
1 -1 6 7 0 0 7 0 3 3
0 0 8 0 2 0 4 0 6 0
1 1 4 4 0 3 3 3 3 0
0 0 0 4 2 1 0 2 2 3
0 0 0 4 0 2 2 2 3 2
1 1 5 2 1 2 5 1 0 3

8.000000
3.650282
3.828427
4.576491
5.019765
5.398346
6.324555
10.676619
10.605551
7.071068
7.634414
1.414214
8.993230
8.993230
9.162278
1.414214
5.841619
5.242641
5.064495
7.621233
4.576491
5.576491
4.000000
4.000000
11.709720
4.000000
9.211103
10.633758
8.000000
6.359174
4.000000
4.000000
5.000000
plot with Python 3
Posted by ASK 11 Apr 2018 21:33
from matplotlib.pyplot import *
from math import *
inp='4 2 2 2 2 1 3 6 4 1'
sx,sy,tx,ty,ax,ay,bx,by,cx,cy = [float(i) for i in inp.split()]
plot(sx,sy,'go')
plot(tx,ty,'ro')
plot([ax,bx,cx],[ay,by,cy],'bo-')
def l(ax,ay,bx,by):
    plot([ax,bx],[ay,by], '--',
         label=str(sqrt((ax-bx)**2 + (ay-by)**2)))
def l2(ax,ay,bx,by,cx,cy):
    plot([ax,bx,cx],[ay,by,cy], '--',
         label=str(sqrt((ax-bx)**2 + (ay-by)**2) + sqrt((cx-bx)**2 + (cy-by)**2)))
def l3(ax,ay,bx,by,cx,cy,dx,dy):
    plot([ax,bx,cx,dx],[ay,by,cy,dy], '--',
         label=str(hypot(ax-bx,ay-by) + hypot(bx-cx,by-cy) + hypot(cx-dx,cy-dy)))
l(sx,sy,tx,ty)
l2(sx,sy,ax,ay,tx,ty)
l2(sx,sy,bx,by,tx,ty)
l2(sx,sy,cx,cy,tx,ty)
l3(sx,sy,bx,by,ax,ay,tx,ty)
l3(sx,sy,bx,by,cx,cy,tx,ty)
l3(sx,sy,ax,ay,cx,cy,tx,ty)
l3(sx,sy,cx,cy,ax,ay,tx,ty)

axis('equal'); grid(); legend(); show()