There was an error while loading. Please reload this page.
1 parent 99380b8 commit 0d490a0Copy full SHA for 0d490a0
1 file changed
kattis/Forest for the trees/forest.shortest.vn.py
@@ -0,0 +1,9 @@
1
+from math import gcd;a,b=map(int,input().split());c=gcd(a,b);a//=c;b//=c;d,e,f,j=map(int,input().split())
2
+d,f=sorted([d,f])
3
+e,j=sorted([e,j])
4
+k=1
5
+while k<c:
6
+ x=k*a;y=k*b;k+=1
7
+ if d<x<=f and e<=y<=j:k=min(f//a,j//b)+1;continue
8
+ print("No\n%d %d"%(x,y));break
9
+else:print("Yes")
0 commit comments