Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- #ifndef Local
- #define debug(...) 1337
- //#define endl '\n'
- #endif
- using namespace std;
- #define int long long
- typedef long long ll;
- typedef long double ld;
- #define all(x) (x).begin(), (x).end()
- #define sz(x) (int)(x).size()
- template<class A, class B>
- bool smin(A &x, B &&y) {
- if (x > y) {
- x = y;
- return true;
- }
- return false;
- }
- template<class A, class B>
- bool smax(A &x, B &&y) {
- if (x < y) {
- x = y;
- return true;
- }
- return false;
- }
- double get(int x, int y) {
- cout << "? " << x << ' ' << y << endl;
- double a;
- cin >> a;
- return a;
- }
- void solve() {
- int x, y;
- cin >> x >> y;
- int l = 0, r = x;
- while (r - l > 1) {
- int m = (l + r) / 2;
- if (get(m, 1) < get(m + 1, 1))
- l = m;
- else
- r = m;
- }
- int a = r;
- l = 0, r = y;
- while (r - l > 1) {
- int m = (l + r) / 2;
- if (get(1, m) < get(1, m + 1))
- l = m;
- else
- r = m;
- }
- cout << "! " << a << ' ' << r << endl;
- }
- signed main() {
- // ios::sync_with_stdio(false), cin.tie(nullptr);
- int tt = 1;
- // cin >> tt;
- while (tt--)
- solve();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement