QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#782642#9734. Identify ChordtarjenAC ✓69ms3780kbC++203.7kb2024-11-25 20:49:572024-11-25 20:49:57

Judging History

This is a historical verdict posted at 2024-11-25 20:49:57.

  • [2024-12-08 23:00:04]
  • 自动重测本题所有获得100分的提交记录
  • Verdict: AC
  • Time: 54ms
  • Memory: 3748kb
  • [2024-12-08 22:59:51]
  • hack成功,自动添加数据
  • (/hack/1274)
  • [2024-11-25 20:49:57]
  • Judged
  • Verdict: 100
  • Time: 69ms
  • Memory: 3780kb
  • [2024-11-25 20:49:57]
  • Submitted

answer

#include <bits/stdc++.h>
using namespace std;
template <typename T1, typename T2>
ostream& operator<<(ostream& out, pair<T1, T2> p) {
    out << "(" << p.first << "," << p.second << ")";
    return out;
}
template <typename T>
ostream& operator<<(ostream& out, vector<T> v) {
    out << "[";
    if (!v.empty()) {
        cout << v[0];
        for (int i = 1; i < v.size(); i++) cout << "," << v[i];
    }
    out << "]";
    return out;
}
#define int long long
const bool gen = false;
mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
int rnd(int B = 2e9) { return (unsigned long long)rng() % B; }
struct Interator {
    int n, sx, sy, query_cnt = 0;
    int dis(int x, int y) { return min(abs(x - y), n - abs(x - y)); }
    void init(int _n, int _sx = 0, int _sy = 0) {
        n = _n;
        query_cnt = 0;
        if (!gen) return;
        sx = _sx, sy = _sy;
        while (dis(sx, sy) <= 1) {
            sx = rnd() % n, sy = (sx + n / 2 + rnd() % max(10ll, n / 5)) % n;
        }
        cout << "n=" << n << " sx=" << sx << " sy=" << sy << endl;
    }
    int query(int x, int y) {
        cout << "? " << x + 1 << " " << y + 1 << endl;
        query_cnt++;
        assert(query_cnt <= 40);
        assert(dis(x, y) > 1);
        if (gen) {
            return min({dis(x, y), dis(x, sx) + dis(sy, y) + 1,
                        dis(x, sy) + dis(y, sx) + 1});
        } else {
            int z;
            cin >> z;
            return z;
        }
    }
    void answer(int x, int y) {
        cout << "! " << x + 1 << " " << y + 1 << endl;
        if (gen) {
            assert(sx ^ sy ^ x ^ y == 0);
        } else {
            int z;
            cin >> z;
            if (z != 1) exit(0);
        }
    }
} sol;
bool test = true;
void solve() {
    int n;
    if (!gen) {
        cin >> n;
        sol.init(n);
    } else {
        n = 1000000000;
        // n = rnd() % 100 + 4;
        sol.init(n, rnd() % n, rnd() % n);
    }
    auto dis = [&](int x, int y) { return min(abs(x - y), n - abs(x - y)); };
    auto pre = [&](int x) { return (x - 1 + n) % n; };
    auto nxt = [&](int x) { return (x + 1) % n; };
    int x = rnd() % n, y = (x + n / 2) % n;
    int nowd = sol.query(x, y);
    int t = 0;
    while (dis(x, y) == nowd) {
        x = (x + n / 4) % n;
        y = (y + n / 4) % n;
        t++;
        nowd = sol.query(x, y);
    }
    // if (test) cout << "getmain x=" << x << " y=" << y << endl;
    if (nowd == 1) {
        sol.answer(x, y);
        return;
    }
    if (sol.query(pre(x), y) == nowd - 1) {
        int l = 2, r = nowd - 1, res = 1;
        while (l <= r) {
            int mid = (l + r) / 2;
            if (sol.query((x - mid + n) % n, y) == nowd - mid) {
                res = mid;
                l = mid + 1;
            } else
                r = mid - 1;
        }
        x = (x - res + n) % n;
        nowd -= res;
    } else if (sol.query(nxt(x), y) == nowd - 1) {
        int l = 2, r = nowd - 1, res = 1;
        while (l <= r) {
            int mid = (l + r) / 2;
            if (sol.query((x + mid) % n, y) == nowd - mid) {
                res = mid;
                l = mid + 1;
            } else
                r = mid - 1;
        }
        x = (x + res) % n;
        nowd -= res;
    }
    if (nowd == 1) {
        sol.answer(x, y);
        return;
    }
    if (int z = sol.query(x, nxt(y)); z == nowd - 1) {
        y = (y + nowd - 1) % n;
    } else {
        y = (y - nowd + 1 + n) % n;
    }
    sol.answer(x, y);
}
signed main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int T;
    cin >> T;
    while (T--) solve();
    return 0;
}

这程序好像有点Bug,我给组数据试试?

详细

Test #1:

score: 100
Accepted
time: 1ms
memory: 3588kb

input:

2
6
2
2
1
1
4
1
1

output:

? 1 4
? 6 4
? 2 4
! 2 4
? 3 1
! 3 1

result:

ok ok (2 test cases)

Test #2:

score: 0
Accepted
time: 8ms
memory: 3644kb

input:

1000
15
6
5
3
2
1
1
19
6
7
5
5
4
3
1
17
7
6
5
5
4
5
1
15
6
7
5
4
5
6
1
14
5
6
6
6
1
15
2
1
1
17
8
2
3
3
1
1
20
8
7
6
8
8
1
13
6
2
3
1
1
18
3
4
4
2
1
13
5
6
4
2
2
1
1
14
7
2
3
3
1
1
17
4
5
3
2
3
3
1
12
3
4
2
3
1
1
10
5
3
4
2
1
1
14
6
6
5
3
2
1
1
19
9
7
8
6
5
5
4
5
1
19
8
9
7
5
6
6
5
1
12
6
2
3
3
3
1
...

output:

? 13 5
? 12 5
? 10 5
? 9 5
? 8 5
! 8 5
? 10 19
? 9 19
? 11 19
? 13 19
? 12 19
? 12 1
! 12 3
? 6 14
? 5 14
? 2 14
? 4 14
? 3 14
? 3 15
! 3 11
? 15 7
? 14 7
? 1 7
? 3 7
? 2 7
? 1 8
! 1 3
? 2 9
? 1 9
? 3 9
? 2 10
! 2 5
? 10 2
? 9 2
! 9 2
? 1 9
? 5 13
? 4 13
? 6 13
? 5 14
! 5 14
? 2 12
? 1 12
? 18 12
? ...

result:

ok ok (1000 test cases)

Test #3:

score: 0
Accepted
time: 10ms
memory: 3720kb

input:

1000
21
7
6
5
5
4
5
1
22
6
5
3
2
3
3
1
20
9
9
8
4
3
3
2
1
22
8
7
7
6
7
7
1
21
7
8
6
3
2
3
1
1
21
7
8
6
3
4
4
1
24
5
6
6
4
1
22
10
10
9
5
3
3
4
1
21
4
5
3
4
2
1
23
8
7
4
4
3
2
1
21
4
5
3
4
4
1
24
12
7
6
5
5
4
3
1
20
9
8
5
7
7
6
1
24
11
10
5
3
2
2
1
1
23
9
8
4
2
3
1
1
23
11
2
3
1
1
23
10
11
10
9
1
23
...

output:

? 3 13
? 2 13
? 20 13
? 1 13
? 21 13
? 21 14
! 21 10
? 7 18
? 6 18
? 4 18
? 3 18
? 2 18
? 3 19
! 3 17
? 19 9
? 18 9
? 20 9
? 4 9
? 6 9
? 5 9
? 5 10
! 5 11
? 9 20
? 8 20
? 5 20
? 7 20
? 6 20
? 7 21
! 7 15
? 2 12
? 1 12
? 3 12
? 6 12
? 7 12
? 8 12
? 7 13
! 7 13
? 11 21
? 10 21
? 12 21
? 15 21
? 16 21
...

result:

ok ok (1000 test cases)

Test #4:

score: 0
Accepted
time: 5ms
memory: 3644kb

input:

1000
25
9
8
4
2
3
1
1
25
11
12
10
6
8
8
7
1
25
10
9
5
3
4
4
1
25
9
8
8
8
7
8
1
26
12
12
11
6
3
2
2
3
1
26
13
7
8
6
3
4
4
1
26
11
12
10
5
3
2
1
1
27
13
12
13
11
6
3
3
4
1
25
9
8
6
6
5
4
1
27
13
10
9
9
7
8
6
1
27
10
11
9
5
6
6
6
1
27
11
10
7
8
7
6
7
1
26
13
5
6
4
4
3
4
1
25
10
9
5
3
4
2
1
27
8
7
10
8
...

output:

? 13 25
? 12 25
? 8 25
? 6 25
? 5 25
? 6 1
! 6 1
? 6 18
? 5 18
? 7 18
? 12 18
? 9 18
? 10 18
? 9 19
! 9 25
? 13 25
? 12 25
? 8 25
? 6 25
? 5 25
? 6 1
! 6 23
? 5 17
? 4 17
? 25 17
? 2 17
? 3 17
? 3 18
! 3 11
? 8 21
? 7 21
? 9 21
? 14 21
? 17 21
? 18 21
? 19 21
? 18 22
! 18 20
? 15 2
? 21 8
? 20 8
? 2...

result:

ok ok (1000 test cases)

Test #5:

score: 0
Accepted
time: 21ms
memory: 3772kb

input:

1000
29
6
5
3
2
1
1
28
7
8
6
7
5
6
4
1
30
9
10
8
6
6
5
4
1
29
10
11
9
5
5
4
3
1
28
10
11
9
9
9
8
7
1
29
5
4
4
3
4
1
29
9
8
10
10
9
7
1
28
11
12
10
5
3
2
1
1
30
6
5
7
6
6
1
30
8
7
10
8
8
1
28
9
10
8
6
6
5
6
1
29
14
13
14
12
6
3
2
1
1
29
11
12
10
5
6
6
6
1
29
14
7
6
7
5
6
4
1
29
13
14
12
6
3
2
2
3
1
3...

output:

? 8 22
? 7 22
? 5 22
? 4 22
? 3 22
! 3 22
? 6 20
? 5 20
? 7 20
? 10 20
? 8 20
? 9 20
? 8 21
! 8 24
? 28 13
? 27 13
? 29 13
? 3 13
? 1 13
? 2 13
? 2 14
! 2 17
? 25 10
? 24 10
? 26 10
? 1 10
? 3 10
? 2 10
? 2 11
! 2 13
? 21 7
? 20 7
? 22 7
? 26 7
? 24 7
? 23 7
? 23 8
! 23 14
? 20 5
? 19 5
? 17 5
? 18 ...

result:

ok ok (1000 test cases)

Test #6:

score: 0
Accepted
time: 10ms
memory: 3696kb

input:

1000
32
16
13
14
12
8
9
8
7
8
1
30
14
14
13
7
5
6
6
7
1
32
14
15
13
9
10
9
8
7
1
31
5
6
4
2
3
3
1
32
5
4
2
3
3
1
32
12
13
11
6
5
5
4
3
1
31
9
10
8
4
6
5
5
1
31
6
5
7
6
4
1
32
12
11
6
3
2
1
1
30
14
13
7
5
7
6
1
31
5
6
6
6
1
31
10
9
11
9
8
7
1
33
16
8
7
4
6
5
3
1
32
15
14
8
11
9
8
8
1
32
8
9
7
6
6
5
4...

output:

? 23 7
? 31 15
? 30 15
? 32 15
? 6 15
? 3 15
? 4 15
? 5 15
? 5 16
! 5 9
? 18 3
? 17 3
? 19 3
? 25 3
? 28 3
? 26 3
? 27 3
? 26 4
! 26 28
? 3 19
? 2 19
? 4 19
? 10 19
? 7 19
? 8 19
? 9 19
? 9 20
! 9 26
? 1 16
? 31 16
? 2 16
? 4 16
? 5 16
? 4 17
! 4 15
? 6 22
? 5 22
? 3 22
? 2 22
? 3 23
! 3 21
? 15 31
...

result:

ok ok (1000 test cases)

Test #7:

score: 0
Accepted
time: 9ms
memory: 3704kb

input:

1000
34
10
9
5
3
4
2
1
33
12
11
11
11
10
11
1
33
16
10
11
9
7
7
6
7
1
34
11
10
5
5
4
5
1
34
13
14
12
6
3
4
2
1
35
14
15
13
9
10
9
8
9
1
34
4
3
2
3
1
1
34
12
13
11
6
5
5
4
3
1
34
16
16
16
16
1
33
10
11
9
5
3
2
3
1
1
33
16
15
16
14
7
4
3
4
5
1
34
16
16
15
8
5
6
5
6
1
33
15
14
7
4
4
5
5
1
34
12
11
11
1...

output:

? 12 29
? 11 29
? 7 29
? 5 29
? 4 29
? 5 30
! 5 31
? 8 24
? 7 24
? 2 24
? 5 24
? 6 24
? 6 25
! 6 15
? 12 28
? 20 3
? 19 3
? 21 3
? 25 3
? 23 3
? 24 3
? 24 4
! 24 31
? 18 1
? 17 1
? 12 1
? 10 1
? 11 1
? 11 2
! 11 32
? 17 34
? 16 34
? 18 34
? 24 34
? 27 34
? 28 34
? 27 1
! 27 2
? 30 12
? 29 12
? 31 12...

result:

ok ok (1000 test cases)

Test #8:

score: 0
Accepted
time: 3ms
memory: 3628kb

input:

1000
36
17
16
9
13
15
16
15
1
36
15
16
14
10
11
9
10
8
1
36
15
14
10
14
15
15
1
36
7
6
9
7
7
1
36
11
12
10
12
12
11
9
1
36
8
9
9
7
1
35
12
13
11
8
9
8
7
8
1
36
15
14
7
4
5
5
5
1
36
18
4
5
3
2
3
3
1
36
16
17
15
8
6
6
5
6
1
36
11
12
10
7
8
7
6
5
1
36
2
3
3
3
1
36
17
17
16
9
13
14
13
14
1
36
9
8
12
10
...

output:

? 21 3
? 20 3
? 12 3
? 16 3
? 18 3
? 19 3
? 20 4
! 20 18
? 29 11
? 28 11
? 30 11
? 1 11
? 33 11
? 35 11
? 36 11
? 35 12
! 35 19
? 5 23
? 4 23
? 33 23
? 1 23
? 3 23
? 4 24
! 4 10
? 4 22
? 3 22
? 36 22
? 2 22
? 3 23
! 3 17
? 5 23
? 4 23
? 6 23
? 11 23
? 8 23
? 7 23
? 6 24
! 6 32
? 21 3
? 20 3
? 22 3
?...

result:

ok ok (1000 test cases)

Test #9:

score: 0
Accepted
time: 0ms
memory: 3700kb

input:

1000
37
7
6
9
7
5
1
36
17
16
9
13
15
15
14
1
38
9
10
8
10
8
7
8
1
37
18
12
11
6
9
7
5
1
37
13
12
12
15
13
13
1
36
12
11
12
11
10
11
1
37
14
15
13
11
10
11
9
1
37
11
12
10
9
8
7
8
6
1
37
17
16
8
4
2
3
1
1
37
18
4
5
3
4
4
1
37
9
10
8
8
6
7
7
1
37
18
17
18
16
9
12
10
9
10
1
36
7
8
6
3
4
2
1
37
15
14
11...

output:

? 28 9
? 27 9
? 24 9
? 26 9
? 27 10
! 27 14
? 30 12
? 29 12
? 21 12
? 25 12
? 27 12
? 28 12
? 28 13
! 28 26
? 5 24
? 4 24
? 6 24
? 10 24
? 8 24
? 7 24
? 7 25
! 7 18
? 18 36
? 27 8
? 26 8
? 21 8
? 18 8
? 20 8
? 21 9
! 21 13
? 20 1
? 19 1
? 13 1
? 16 1
? 18 1
? 19 2
! 19 27
? 25 7
? 24 7
? 19 7
? 22 7...

result:

ok ok (1000 test cases)

Test #10:

score: 0
Accepted
time: 2ms
memory: 3776kb

input:

1000
39
9
8
10
8
7
6
1
38
8
7
10
8
6
1
38
9
10
8
10
8
7
8
1
39
13
12
6
3
2
1
1
38
15
14
11
11
9
10
8
1
39
4
3
2
3
1
1
39
19
15
14
9
11
9
8
7
1
38
18
17
10
14
16
16
15
1
39
19
13
14
12
8
9
8
7
8
1
39
12
11
6
5
5
4
3
1
39
12
11
10
9
8
9
9
1
38
18
17
9
5
4
5
4
1
39
11
12
12
10
1
38
12
11
6
5
5
4
3
1
39...

output:

? 27 7
? 26 7
? 22 7
? 24 7
? 25 7
? 25 8
! 25 13
? 34 15
? 33 15
? 30 15
? 32 15
? 33 16
! 33 21
? 13 32
? 12 32
? 14 32
? 18 32
? 16 32
? 15 32
? 15 33
! 15 26
? 22 2
? 21 2
? 15 2
? 12 2
? 11 2
? 10 2
! 10 2
? 32 13
? 31 13
? 24 13
? 28 13
? 26 13
? 25 13
? 26 14
! 26 21
? 3 22
? 2 22
? 1 22
? 39...

result:

ok ok (1000 test cases)

Test #11:

score: 0
Accepted
time: 5ms
memory: 3572kb

input:

1000
40
8
9
7
4
6
5
3
1
40
6
5
7
6
4
1
40
11
10
5
7
6
4
1
40
10
11
9
13
11
10
8
1
40
20
16
15
10
12
10
9
8
1
40
5
4
2
3
3
1
41
14
13
7
4
2
1
1
40
15
16
14
12
11
13
12
10
1
40
18
17
11
13
11
10
9
1
40
10
11
9
11
9
8
7
1
40
8
9
7
8
6
7
5
1
41
7
8
6
3
2
3
1
1
40
15
16
14
11
11
9
10
8
1
40
10
11
9
9
7
8...

output:

? 3 23
? 2 23
? 4 23
? 7 23
? 9 23
? 8 23
? 7 24
! 7 26
? 28 8
? 27 8
? 25 8
? 26 8
? 27 9
! 27 12
? 9 29
? 8 29
? 3 29
? 1 29
? 2 29
? 3 30
! 3 33
? 13 33
? 12 33
? 14 33
? 18 33
? 16 33
? 15 33
? 14 34
! 14 1
? 25 5
? 35 15
? 34 15
? 27 15
? 31 15
? 29 15
? 28 15
? 28 16
! 28 23
? 36 16
? 35 16
? ...

result:

ok ok (1000 test cases)

Test #12:

score: 0
Accepted
time: 9ms
memory: 3580kb

input:

1000
42
17
16
8
4
6
5
5
1
41
17
16
8
4
6
5
3
1
41
17
18
16
11
12
12
11
10
1
41
8
7
4
6
5
5
1
41
20
9
8
8
6
7
5
1
41
12
11
14
11
10
11
1
41
19
18
11
16
16
17
17
1
41
2
1
1
41
15
16
14
7
4
6
5
3
1
41
14
15
13
7
4
2
3
3
1
41
20
1
1
42
20
20
19
11
16
18
19
20
1
41
8
7
4
2
3
1
1
41
20
6
7
5
3
4
4
1
42
21...

output:

? 30 9
? 29 9
? 21 9
? 17 9
? 15 9
? 16 9
? 17 10
! 17 6
? 10 30
? 9 30
? 1 30
? 38 30
? 36 30
? 37 30
? 38 31
! 38 33
? 10 30
? 9 30
? 11 30
? 19 30
? 15 30
? 17 30
? 16 30
? 16 31
! 16 40
? 40 19
? 39 19
? 36 19
? 34 19
? 35 19
? 36 20
! 36 16
? 16 36
? 26 5
? 25 5
? 21 5
? 23 5
? 22 5
? 23 6
! 23...

result:

ok ok (1000 test cases)

Test #13:

score: 0
Accepted
time: 14ms
memory: 3728kb

input:

1000
43
10
11
9
5
5
4
3
1
42
18
19
17
9
5
3
2
3
3
1
43
6
7
5
3
2
3
3
1
43
5
4
4
3
4
1
43
15
14
7
10
8
6
1
43
13
14
12
6
5
5
4
3
1
43
19
18
12
14
12
11
12
10
1
43
21
20
21
19
10
6
8
7
7
8
1
42
15
14
13
17
15
15
1
42
20
20
19
11
15
13
13
14
1
42
7
6
5
5
4
5
1
43
20
21
19
11
15
13
13
12
1
42
11
10
13
1...

output:

? 40 18
? 39 18
? 41 18
? 2 18
? 4 18
? 3 18
? 3 19
! 3 21
? 42 21
? 41 21
? 1 21
? 9 21
? 13 21
? 15 21
? 16 21
? 17 21
? 16 22
! 16 20
? 1 22
? 43 22
? 2 22
? 4 22
? 5 22
? 6 22
? 5 23
! 5 21
? 16 37
? 15 37
? 13 37
? 14 37
? 14 38
! 14 35
? 13 34
? 12 34
? 5 34
? 2 34
? 4 34
? 5 35
! 5 40
? 30 8
...

result:

ok ok (1000 test cases)

Test #14:

score: 0
Accepted
time: 0ms
memory: 3640kb

input:

1000
44
14
15
13
11
10
9
10
10
1
44
17
16
8
9
10
9
9
1
43
13
12
6
3
2
3
3
1
43
12
13
11
6
3
4
4
1
44
17
16
12
12
10
11
9
1
44
16
15
8
4
2
1
1
44
19
20
18
9
5
5
4
3
1
44
6
5
3
2
1
1
43
13
14
12
14
13
11
12
10
1
43
20
21
19
11
15
13
12
12
11
1
44
22
9
10
8
6
6
5
6
1
44
20
21
19
12
15
13
12
11
12
1
44
...

output:

? 36 14
? 35 14
? 37 14
? 43 14
? 40 14
? 41 14
? 42 14
? 41 15
! 41 6
? 14 36
? 13 36
? 5 36
? 1 36
? 3 36
? 4 36
? 5 37
! 5 29
? 4 25
? 3 25
? 40 25
? 37 25
? 36 25
? 35 25
? 36 26
! 36 24
? 9 30
? 8 30
? 10 30
? 15 30
? 18 30
? 19 30
? 18 31
! 18 28
? 9 31
? 8 31
? 44 31
? 4 31
? 2 31
? 1 31
? 2 ...

result:

ok ok (1000 test cases)

Test #15:

score: 0
Accepted
time: 0ms
memory: 3644kb

input:

1000
45
18
19
17
13
17
17
16
17
1
45
8
9
7
4
6
5
5
1
45
15
16
14
14
15
13
14
12
1
45
12
11
10
9
8
9
9
1
45
12
11
12
9
10
8
1
45
3
2
3
3
1
45
19
18
13
18
20
19
17
1
45
19
18
9
9
11
10
10
1
44
19
20
18
9
5
3
2
1
1
45
19
18
13
16
16
15
16
1
44
20
19
10
5
5
6
4
1
45
15
16
14
13
11
11
10
11
1
44
18
19
17...

output:

? 43 20
? 42 20
? 44 20
? 7 20
? 3 20
? 1 20
? 45 20
? 45 21
! 45 5
? 38 15
? 37 15
? 39 15
? 42 15
? 44 15
? 43 15
? 42 16
! 42 12
? 16 38
? 15 38
? 17 38
? 24 38
? 20 38
? 18 38
? 19 38
? 18 39
! 18 5
? 36 13
? 35 13
? 30 13
? 33 13
? 32 13
? 31 13
? 32 14
! 32 6
? 17 39
? 16 39
? 11 39
? 14 39
? ...

result:

ok ok (1000 test cases)

Test #16:

score: 0
Accepted
time: 8ms
memory: 3708kb

input:

1000
46
22
21
12
16
14
13
13
13
1
46
3
2
1
1
46
18
19
17
14
15
15
14
13
1
46
19
18
9
7
7
6
5
1
46
23
5
4
6
5
3
1
46
21
22
20
10
7
8
9
7
1
46
6
7
7
7
1
46
10
11
9
5
3
2
3
1
1
46
22
22
21
12
16
14
13
13
14
1
46
19
18
9
9
11
10
10
1
45
21
20
10
5
3
2
3
3
1
46
6
7
7
7
1
46
18
17
9
5
3
2
1
1
46
21
20
12
...

output:

? 20 43
? 19 43
? 9 43
? 14 43
? 12 43
? 11 43
? 10 43
? 11 44
! 11 31
? 6 29
? 5 29
? 4 29
! 4 29
? 3 26
? 2 26
? 4 26
? 12 26
? 8 26
? 6 26
? 7 26
? 7 27
! 7 39
? 24 1
? 23 1
? 14 1
? 10 1
? 12 1
? 11 1
? 11 2
! 11 6
? 10 33
? 21 44
? 20 44
? 18 44
? 19 44
? 20 45
! 20 1
? 1 24
? 46 24
? 2 24
? 12...

result:

ok ok (1000 test cases)

Test #17:

score: 0
Accepted
time: 69ms
memory: 3780kb

input:

1000
1000000000
499999999
499999999
499999998
249999999
125000000
62500000
31250001
46875000
39062501
42968750
41015626
41992188
41503907
41259766
41137696
41076661
41046143
41030884
41023255
41019441
41021348
41020394
41019918
41020156
41020038
41020098
41020127
41020112
41020105
41020101
41020100
...

output:

? 413067482 913067482
? 413067481 913067482
? 413067483 913067482
? 663067482 913067482
? 788067481 913067482
? 850567481 913067482
? 881817481 913067482
? 866192481 913067482
? 874004981 913067482
? 870098731 913067482
? 872051856 913067482
? 871075293 913067482
? 871563574 913067482
? 871807715 91...

result:

ok ok (1000 test cases)

Test #18:

score: 0
Accepted
time: 40ms
memory: 3644kb

input:

1000
1000000000
499999969
499999968
249999984
124999992
62499996
31249998
15624999
7812531
11718781
13671906
14648437
14160156
13916047
14038117
14099121
14068635
14083863
14076265
14080049
14078173
14079096
14078650
14078858
14078739
14078679
14078649
14078640
14078642
14078638
14078638
14078637
14...

output:

? 889172237 389172237
? 889172236 389172237
? 639172252 389172237
? 514172260 389172237
? 451672264 389172237
? 420422266 389172237
? 404797267 389172237
? 396984768 389172237
? 400891018 389172237
? 402844143 389172237
? 403820705 389172237
? 403332424 389172237
? 403088284 389172237
? 403210354 38...

result:

ok ok (1000 test cases)

Test #19:

score: 0
Accepted
time: 49ms
memory: 3576kb

input:

1000
1000000000
242488987
242488986
121244495
181866740
151555617
136400055
128822274
125033384
123138939
122191716
121718105
121481299
121362896
121303695
121274094
121259294
121251894
121248194
121246344
121245419
121244956
121244725
121244609
121244551
121244522
121244508
121244501
121244497
1212...

output:

? 858318589 358318589
? 858318588 358318589
? 737074095 358318589
? 797696342 358318589
? 767385219 358318589
? 752229657 358318589
? 744651876 358318589
? 740862986 358318589
? 738968541 358318589
? 738021318 358318589
? 737547707 358318589
? 737310901 358318589
? 737192498 358318589
? 737133297 35...

result:

ok ok (1000 test cases)

Test #20:

score: 0
Accepted
time: 32ms
memory: 3728kb

input:

1000
1000000000
477848746
477848747
477848745
238924373
141613441
201344534
231210081
246142854
246390689
242657496
240790899
239857601
239390952
239157627
239040965
238982634
238953468
238938885
238931594
238927948
238926125
238925214
238924758
238924530
238924416
238924359
238924345
238924345
2389...

output:

? 145832938 645832938
? 145832937 645832938
? 145832939 645832938
? 384757311 645832938
? 504219497 645832938
? 444488404 645832938
? 414622857 645832938
? 399690084 645832938
? 392223697 645832938
? 388490504 645832938
? 386623907 645832938
? 385690609 645832938
? 385223960 645832938
? 384990635 64...

result:

ok ok (1000 test cases)

Test #21:

score: 0
Accepted
time: 51ms
memory: 3708kb

input:

1000
1000000000
288090905
288090904
268613422
216068178
232602059
214596377
207065338
210094956
207844246
206718891
206502661
206437552
206361992
206367217
206332049
206344409
206335617
206331221
206329851
206330122
206329573
206329576
206329438
206329505
206329471
206329454
206329445
206329441
2063...

output:

? 39889419 539889419
? 39889418 539889419
? 895843966 539889419
? 967866692 539889419
? 931855329 539889419
? 949861011 539889419
? 958863852 539889419
? 954362432 539889419
? 956613142 539889419
? 957738497 539889419
? 958301175 539889419
? 958019836 539889419
? 958160506 539889419
? 958090171 5398...

result:

ok ok (1000 test cases)

Test #22:

score: 0
Accepted
time: 55ms
memory: 3704kb

input:

1000
999999999
499999998
499999999
499999997
249999999
125000000
62500000
31250001
46875000
39062501
42968751
44921876
45898438
45410158
45654298
45532229
45593263
45562746
45547488
45555117
45551303
45553211
45554165
45554642
45554880
45554998
45554939
45554909
45554894
45554887
45554883
45554882
4...

output:

? 764173430 264173430
? 764173429 264173430
? 764173431 264173430
? 14173430 264173430
? 139173429 264173430
? 201673429 264173430
? 232923429 264173430
? 217298429 264173430
? 225110929 264173430
? 221204679 264173430
? 219251554 264173430
? 218274991 264173430
? 218763272 264173430
? 218519131 264...

result:

ok ok (1000 test cases)

Test #23:

score: 0
Accepted
time: 41ms
memory: 3708kb

input:

1000
999999999
499999956
499999957
499999955
250000021
374999967
312499973
281250019
296875018
304687474
300781268
302734350
301757788
301269550
301513648
301391578
301330543
301300025
301284766
301277180
301280995
301282902
301283813
301283379
301283575
301283492
301283516
301283486
301283477
30128...

output:

? 489459656 989459655
? 489459655 989459655
? 489459657 989459655
? 739459634 989459655
? 614459645 989459655
? 676959639 989459655
? 708209636 989459655
? 692584637 989459655
? 684772138 989459655
? 688678387 989459655
? 686725262 989459655
? 687701824 989459655
? 688190105 989459655
? 687945964 98...

result:

ok ok (1000 test cases)

Test #24:

score: 0
Accepted
time: 47ms
memory: 3604kb

input:

1000
999999999
420777005
420777004
210388504
315582753
262985628
236687065
223537784
216963143
213675823
212032163
211210333
210799418
210593960
210491231
210439867
210414185
210401344
210394923
210391713
210390108
210389305
210388904
210388703
210388603
210388553
210388528
210388515
210388509
21038...

output:

? 372661475 872661474
? 372661474 872661474
? 162272972 872661474
? 267467223 872661474
? 214870098 872661474
? 188571535 872661474
? 175422254 872661474
? 168847613 872661474
? 165560293 872661474
? 163916633 872661474
? 163094803 872661474
? 162683888 872661474
? 162478430 872661474
? 162375701 87...

result:

ok ok (1000 test cases)

Test #25:

score: 0
Accepted
time: 53ms
memory: 3584kb

input:

1000
999999999
157644670
157644669
78822401
118233502
98527919
88675127
83748731
81285533
80053934
79438135
79130235
78976285
78899310
78860823
78841579
78831957
78827146
78824741
78823538
78822937
78822636
78822486
78822411
78822373
78822382
78822372
78822369
78822369
78822368
78822369
1
999999999
...

output:

? 335314794 835314793
? 335314793 835314793
? 256492459 835314793
? 295903626 835314793
? 276198043 835314793
? 266345251 835314793
? 261418855 835314793
? 258955657 835314793
? 257724058 835314793
? 257108259 835314793
? 256800359 835314793
? 256646409 835314793
? 256569434 835314793
? 256530947 83...

result:

ok ok (1000 test cases)

Test #26:

score: 0
Accepted
time: 61ms
memory: 3700kb

input:

1000
999999999
249264884
249264885
249264883
124632442
120821979
93474332
105242923
97453395
93558631
91611249
92500642
92013797
91770374
91648663
91587807
91580821
91572593
91573214
91569410
91570692
91569741
91569266
91569172
91569147
91569112
91569118
91569103
91569104
91569100
91569102
91569101
...

output:

? 599579222 99579222
? 599579221 99579222
? 599579223 99579222
? 724211664 99579222
? 786527885 99579222
? 755369774 99579222
? 770948829 99579222
? 763159301 99579222
? 759264537 99579222
? 757317155 99579222
? 756343464 99579222
? 756830309 99579222
? 757073732 99579222
? 757195443 99579222
? 7572...

result:

ok ok (1000 test cases)

Test #27:

score: 0
Accepted
time: 42ms
memory: 3696kb

input:

1000
536870912
108355805
108355804
54177902
27088951
30075634
23303396
23702833
22009774
22456866
22033601
21821968
21903958
21851050
21824596
21811369
21815354
21812047
21810394
21810543
21810130
21810187
21810083
21810079
21810057
21810066
21810060
21810057
21810055
21810056
21810054
1
536870912
1...

output:

? 438428127 169992671
? 438428126 169992671
? 384250224 169992671
? 357161273 169992671
? 343616798 169992671
? 350389036 169992671
? 353775155 169992671
? 352082096 169992671
? 351235566 169992671
? 351658831 169992671
? 351870464 169992671
? 351976280 169992671
? 351923372 169992671
? 351896918 16...

result:

ok ok (1000 test cases)

Test #28:

score: 0
Accepted
time: 45ms
memory: 3636kb

input:

1000
536870911
244408484
244408485
244408483
122204242
85129092
93120274
106928712
99290947
95472065
93562624
92607903
92642913
92404233
92488563
92428893
92399058
92389315
92391600
92387871
92387450
92386939
92386983
92386750
92386823
92386765
92386736
92386735
92386729
92386731
92386729
92386728
9...

output:

? 296442211 28006755
? 296442210 28006755
? 296442212 28006755
? 418646453 28006755
? 479748574 28006755
? 449197513 28006755
? 433921983 28006755
? 441559748 28006755
? 445378630 28006755
? 447288071 28006755
? 448242792 28006755
? 448720152 28006755
? 448481472 28006755
? 448362132 28006755
? 4484...

result:

ok ok (1000 test cases)

Extra Test:

score: 0
Extra Test Passed