forked from tamimsal/Problem-Solving
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path1680A
More file actions
39 lines (30 loc) · 583 Bytes
/
1680A
File metadata and controls
39 lines (30 loc) · 583 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define debug(x) cout<<"[" << #x << " is:" << x << "] "<<endl;
#define endl '\n'
//By: Tamim
void solve() {
int l1,r1,l2,r2;
cin >> l1 >> r1 >> l2 >> r2 ;
if(l1 > l2){
swap(l1,l2);
swap(r1,r2);
}
if(l2 >= l1 && l2 <= r1){
cout << l2 << endl;
}
else{
cout << l1 + l2 << endl;
}
}
int32_t main() {
ios::sync_with_stdio(false);cin.tie(0);
cout.tie(0);
int t =1 ;
cin >>t;
while (t--) {
solve();
}
return 0;
}