Clubs Of Nirma
Practice
5 (1 votes)
Easy
Problem
39% Success 41 Attempts 20 Points 1s Time Limit 256MB Memory 1024 KB Max Code

Out  of 18,00,88,99,999 clubs of Nirma University ,there are 2 main clubs 'Club A' and 'Club B'.

There are 'n' no. of students in Nirma. Out of which 'm' students are members of  club A and 'k' students are members of Club B. A student can be a member of both clubs.A student may be not a member of any club.

Loyal members means they are members of one and only one club.

So Presidents of clubs want to find maximum and minimum possible common members of Club A and Club B and maximum and minimum of loyal members of Club A and Club B, so that they can find best upcoming board members for their club.

As Presidents of clubs are very busy in organizing events,help them finding maximum and minimum posible common and loyal members of Clubs.

Constraints :-

\(1 \leq T \leq 10^{5}\)

\(0 \leq m,k \leq n \leq 10^{18}\)

Input : -

First line contains no. of test cases T.
Next T line contains three space-separated integers n , m , and k. The total number of students,members of Club A ,members of Club B respectively.

Output : -

For each test case 

Print 3 lines, each with two space-separated integers

First line has maximum and minimum possible common members.

Second line has maximum and minimum possible loyal members of Club A.

Third line has maximum and minimum possible loyal members of Club B.

Please login to use the editor

You need to be logged in to access the code editor

Loading...

Please wait while we load the editor

Loading...
Results
Custom Input
Run your code to see the output
Submissions
Please login to view your submissions
Similar Problems
Points:20
3 votes
Tags:
MathematicsSetEasyMathamatics
Editorial

No editorial available for this problem.