MCPcopy Create free account
hub / github.com/Vishruth-S/CompetitiveCode / solve

Function solve

CodeChef_problems/Bob and His Friends/Solution.py:21–42  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

19rls = lambda : list(rm())
20
21def solve():
22 test = r1();
23 while(test>0):
24 test-=1;
25 n,a,b,c=rm();
26 ls = rls();
27 ans=abs(a-b)+c;
28 if(a>b):
29 a,b=b,a;
30 temp=ls[0]
31 for i in ls:
32 x=0
33 if(i>=a and i<=b):
34 temp=0;
35 break;
36 else:
37 x=min(abs(a-i),abs(b-i));
38 if(temp>x):
39 temp=x;
40 if(temp!=0):
41 ans+=2*temp;
42 print(ans);
43
44
45def def_value():

Callers 1

Solution.pyFile · 0.70

Calls 2

absFunction · 0.85
minFunction · 0.85

Tested by

no test coverage detected