Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- #define tani_nachi_ke ios_base::sync_with_stdio(false); cin.tie(NULL);
- #define M_PI 3.14159265358979323846
- #define data data_
- #define ff first
- #define ss second
- #define pb push_back
- #define ld long double
- #define int long long
- #define print(t) cout << "Case #" << t << ": ";
- // for line x = 0
- int funx(int X)
- {
- int l = -1e9;
- int r = 1;
- while(l < r)
- {
- int mid = (l + r - 1)/2;
- cout << X << " " << mid << endl;
- string s;
- cin >> s;
- if(s == "MISS")
- {
- l = mid + 1;
- }
- else if(s == "HIT")
- {
- r = mid;
- }
- else
- {
- return mid;
- }
- }
- int a = l;
- l = -1, r = 1e9;
- while(l < r)
- {
- int mid = (l + r + 1)/2;
- cout << X << " " << mid << endl;
- string s;
- cin >> s;
- if(s == "MISS")
- {
- r = mid - 1;
- }
- else if(s == "HIT")
- {
- l = mid;
- }
- else
- {
- return mid;
- }
- }
- int b = l;
- if(a != 1 && b != -1)
- return (a + b)/2;
- else if(a != 1)
- return a;
- else if(b != -1)
- return b;
- else
- return -3e9;
- }
- // for line y = 0
- int funy(int Y)
- {
- int l = -1e9;
- int r = 1;
- while(l < r)
- {
- int mid = (l + r - 1)/2;
- cout << mid << " " << Y << endl;
- string s;
- cin >> s;
- if(s == "MISS")
- {
- l = mid + 1;
- }
- else if(s == "HIT")
- {
- r = mid;
- }
- else
- {
- return mid;
- }
- }
- int a = l;
- l = -1, r = 1e9;
- while(l < r)
- {
- int mid = (l + r + 1)/2;
- cout << mid << " " << Y << endl;
- string s;
- cin >> s;
- if(s == "MISS")
- {
- r = mid - 1;
- }
- else if(s == "HIT")
- {
- l = mid;
- }
- else
- {
- return mid;
- }
- }
- int b = l;
- if(a != 1 && b != -1)
- return (a + b)/2;
- else if(a != 1)
- return a;
- else if(b != -1)
- return b;
- else
- return -3e9;
- }
- int32_t main()
- {
- int T;
- cin >> T;
- int a,b;
- cin >> a >> b;
- while(T--)
- {
- vector<pair<int,int>> points;
- int x = funy(0);
- int y = funx(0);
- bool ok = 0;
- int a[7] = {-3, -2, -1, 0, 1, 2, 3};
- for(int i = 0; i < 7; i++)
- {
- if(ok)
- break;
- for(int j = 0; j < 7; j++)
- {
- int curx = x + a[i];
- int cury = y + a[j];
- cout << curx << " " << cury << endl;
- string s;
- cin >> s;
- if(s == "CENTER")
- {
- ok = 1;
- break;
- }
- }
- }
- if(!ok)
- return 0;
- }
- return 0;
- }
Add Comment
Please, Sign In to add comment