(I7
I124
I149
(dp0
Vmetro.%l
p1
(Vmetro.cpp
p2
S'#include <iostream>\r\nusing namespace std;\r\nint main(){\r\nlong long n=0, m=0, a=0, b=0, bigs=0, mins=0, ibla=0, iblb=0;\r\ncin>>n>>m;\r\nlong long big[m], i;\r\nfor(i=0;i<m;i=i+1){\r\n    cin>>big[i];\r\n}\r\ncin>>a>>b;\r\n\r\n\r\n\r\n\r\nlong long otdalechenosta=99999999999;\r\nfor(i=0;i<m;i=i+1){\r\n    if(big[i]>a){\r\n        if(big[i]-a<otdalechenosta){\r\n            otdalechenosta=big[i]-a;\r\n            ibla=i;\r\n        }\r\n    }else   if(big[i]<a){\r\n        if(a-big[i]<otdalechenosta){\r\n            otdalechenosta=a-big[i];\r\n            ibla=i;\r\n        }\r\n    }\r\n}\r\n\r\nlong long otdalechenostb=99999999999;\r\nfor(i=0;i<m;i=i+1){\r\n    if(big[i]>b){\r\n        if(big[i]-b<otdalechenostb){\r\n            otdalechenostb=big[i]-b;\r\n            iblb=i;\r\n        }\r\n    }else   if(big[i]<b){\r\n        if(b-big[i]<otdalechenostb){\r\n            otdalechenostb=b-big[i];\r\n            iblb=i;\r\n        }\r\n    }\r\n}\r\n\r\n\r\n\r\n\r\nfor(i=ibla;i<iblb;i=i+1){\r\n    if(big[i]+1==big[i+1]){\r\n        mins=mins+1;\r\n    }else{\r\n        bigs=bigs+1;\r\n    }\r\n}\r\n\r\n\r\nmins=mins+otdalechenosta;\r\nmins=mins+otdalechenostb;\r\ncout<<mins+bigs*2<<endl;\r\nreturn 0;\r\n}\r\n'
p3
tp4
stp5
.