-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathManhattan_Rectangle.cpp
More file actions
52 lines (38 loc) · 961 Bytes
/
Manhattan_Rectangle.cpp
File metadata and controls
52 lines (38 loc) · 961 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
41
42
43
44
45
46
47
48
49
50
51
52
// https://www.codechef.com/FEB19B/problems/MANRECT
#include <bits/stdc++.h>
using namespace std;
int main()
{
int t;
cin >> t;
while(t--)
{
long xl, xu, yl, yu, R1, R2, R3, R4, R5, R6, R7;
//first
cout << "Q 0 0" << endl;
cin >> R1;
//R1 = xl + yl;
//second
cout << "Q 1000000000 0" << endl;
cin >> R2;
//R2 = 1000000000 - xu + yl;
long midx = (1000000000 + R1 - R2)/2;
//third
cout << "Q " << midx << " 0" << endl;
cin >> R3;
yl = R3;
xl = R1 - yl;
xu = 1000000000 + yl - R2;
//fourth
cout << "Q 0 1000000000" << endl;
cin >> R4;
//R4 = 1000000000 - yu + xl
yu = 1000000000 + xl - R4;
cout << "A "<< xl << " " << yl << " " << xu << " " << yu << endl;
int flag;
cin >> flag;
if(flag < 0)
break;
}
return 0;
}