-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path2109b.cpp
More file actions
40 lines (38 loc) · 816 Bytes
/
2109b.cpp
File metadata and controls
40 lines (38 loc) · 816 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
40
#include <bits/stdc++.h>
using namespace std;
#define NO cout<<"NO\n"
#define YES cout<<"YES\n"
#define F first
#define S second
#define cases int _; cin >> _; while(_--)
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef pair<int, int> pi;
typedef set<int> si;
void solve() {
int n,m,a,b; cin >> n >> m >> a >> b;
int moves = 0;
while(m > 1 || n > 1) {
int max_dist = max(a, b);
if(max_dist == a) {
n = a;
} else {
m = b;
}
//zaebal nahui
a = max(1, n/2);
b = max(1, m/2);
cout << n << ' ' << m << ' ' << a << ' ' << b;
cout << '\n';
moves++;
}
cout << moves << '\n';
return;
}
int main() {
cases {
solve();
}
return 0;
}