Advertisement
Guest User

Untitled

a guest
Dec 8th, 2019
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.84 KB | None | 0 0
  1. //#define _CRT_SECURE_NO_WARNINGS
  2. //#pragma comment(linker,"/STACK:64000000")
  3. #include <stdio.h>
  4. #include <iostream>
  5. #include <math.h>
  6. #include <vector>
  7. #include <map>
  8. #include <set>
  9. #include <algorithm>
  10. #include <queue>
  11. #include <string>
  12. #include <string.h>
  13. #include <ctype.h>
  14. #include <iomanip>
  15. #include <iterator>
  16. #include <unordered_map>
  17. #include <unordered_set>
  18. #include <stdlib.h>
  19. #include <stack>
  20. #include <cstdio>
  21. #include <time.h>
  22.  
  23.  
  24. using namespace std;
  25.  
  26.  
  27. typedef long long ll;
  28. typedef pair<int, int> pii;
  29. typedef vector<int> vi;
  30. typedef vector<vi> vvi;
  31.  
  32.  
  33. #define all(x) x.begin(),x.end()
  34. #define mp make_pair
  35. #define eps 1e-7
  36. #define PI 3.14159265358979323846
  37. #define ACCEPTED return 0;
  38. #define optimize cin.sync_with_stdio(false);cout.sync_with_stdio(false);cin.tie(0);
  39.  
  40. const ll infinity = (ll) 1e18;
  41. #ifdef _DEBUG
  42.     const int maxlen = (int)(1e1) + 10;
  43. #else
  44.     const int maxlen = (int)(1e5) + 10;
  45. #endif
  46. const int base = (int)(1e9);
  47. const ll mod = base + 7;
  48.  
  49. #define name ""
  50.  
  51. int main() {
  52. //#ifdef _DEBUG
  53. //   freopen("input.txt", "rt", stdin);
  54. //   freopen("output.txt", "wt", stdout);
  55. /*#else
  56. //   freopen(name".in", "rt", stdin);
  57. //    freopen(name".out", "wt", stdout);*/
  58. //#endif
  59.     //optimize;
  60.  
  61.     int lx = 0, rx = maxlen, x, ans;
  62.     while(rx - lx > 1)
  63.     {
  64.         x = rx+lx;
  65.         x>>=1;
  66.         printf("? 1 0 %d\n",x);
  67.         fflush(stdout);
  68.         scanf("%d",&ans);
  69.         if(ans)
  70.             rx = x;
  71.         else
  72.             lx = x;
  73.     }
  74.     int ly = 0, ry = maxlen, y;
  75.     while(ry - ly > 1)
  76.     {
  77.         y = ry+ly;
  78.         y>>=1;
  79.         printf("? 0 1 %d\n",y);
  80.         fflush(stdout);
  81.         scanf("%d",&ans);
  82.         if(ans)
  83.             ry = y;
  84.         else
  85.             ly = y;
  86.     }
  87.  
  88.     printf("! %d %d\n",lx,ly);
  89.     fflush(stdout);
  90.  
  91.     ACCEPTED
  92. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement