Intersection (2)

Let a,b,c,da, b, c, d be integers such that a≀ba\le b and c≀dc\le d. Write a function @intersection2(a, b, c, d)@ that computes the intersection of intervals [a,b][a, b] and [c,d][c, d]. When the intersection is non empty the function has to return tuple (π‘‡π‘Ÿπ‘’π‘’,p,q)(\mathit{True}, p, q) where integers pp and qq are such that [p,q]=[a,b]∩[c,d][p, q] = [a, b] \cap [c, d]. If the intersection is empty, the function must return tuple (πΉπ‘Žπ‘™π‘ π‘’,1,0)(\mathit{False}, 1, 0)

Sample session

Problem information

Author:Β ProAl

Generation: 2026-01-25T19:44:09.558Z

© Jutge.org, 2006–2026.
https://jutge.org