QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#854710#9734. Identify Chorducup-team3099#WA 62ms3892kbC++205.6kb2025-01-12 06:36:342025-01-12 06:36:35

Judging History

你现在查看的是最新测评结果

  • [2025-01-12 06:36:35]
  • 评测
  • 测评结果:WA
  • 用时:62ms
  • 内存:3892kb
  • [2025-01-12 06:36:34]
  • 提交

answer

#ifdef LOCAL
#define _GLIBCXX_DEBUG 1
#define dbg(...) cerr << "LINE(" << __LINE__ << ") -> [" << #__VA_ARGS__ << "]: [", DBG(__VA_ARGS__)
#else
#define dbg(...) 0
#endif

#if 0
    #include <ext/pb_ds/assoc_container.hpp>
    #include <ext/pb_ds/tree_policy.hpp>
 
    template<class T>
    using ordered_set = __gnu_pbds::tree<T, __gnu_pbds::null_type, std::less<T>, __gnu_pbds::rb_tree_tag,
        __gnu_pbds::tree_order_statistics_node_update>;
#endif

#include <vector> 
#include <list> 
#include <map> 
#include <set> 
#include <queue>
#include <stack> 
#include <bitset> 
#include <algorithm> 
#include <numeric> 
#include <utility> 
#include <sstream> 
#include <iostream> 
#include <iomanip> 
#include <cstdio> 
#include <cmath> 
#include <cstdlib> 
#include <ctime> 
#include <cstring>
#include <random>
#include <chrono>
#include <cassert>

using namespace std;
 
#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define sz(x) (int)(x).size()
#define all(x) begin(x), end(x)
#define FOR(i,a,b) for (int i = (a); i < (b); ++i)
#define F0R(i,a) FOR(i,0,a)
#define REP(i,n) for(int (i)=0;(i)<(int)(n);(i)++)

#define each(a,x) for (auto& a: x)
#define tcT template<class T
#define tcTU tcT, class U
#define tcTUU tcT, class ...U
template<class T> using V = vector<T>; 
template<class T, size_t SZ> using AR = array<T,SZ>;

typedef string str;
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
 
template<typename T, typename U> T &ctmax(T &x, const U &y){ return x = max<T>(x, y); }
template<typename T, typename U> T &ctmin(T &x, const U &y){ return x = min<T>(x, y); }
 
mt19937 rng((unsigned)chrono::steady_clock::now().time_since_epoch().count());
 
#define ts to_string
str ts(char c) { return str(1,c); }
str ts(bool b) { return b ? "true" : "false"; }
str ts(const char* s) { return (str)s; }
str ts(str s) { return s; }
str ts(vector<bool> v) { str res = "{"; F0R(i,sz(v)) res += char('0'+v[i]);	res += "}"; return res; }
template<size_t SZ> str ts(bitset<SZ> b) { str res = ""; F0R(i,SZ) res += char('0'+b[i]); return res; }
template<class A, class B> str ts(pair<A,B> p);
template<class T> str ts(T v) { bool fst = 1; str res = "{"; for (const auto& x: v) {if (!fst) res += ", ";	fst = 0; res += ts(x);}	res += "}"; return res;}
template<class A, class B> str ts(pair<A,B> p) {return "("+ts(p.first)+", "+ts(p.second)+")"; }
 
template<class A> void pr(A x) { cout << ts(x); }
template<class H, class... T> void pr(const H& h, const T&... t) { pr(h); pr(t...); }
void ps() { pr("\n"); }
template<class H, class... T> void ps(const H& h, const T&... t) { pr(h); if (sizeof...(t)) pr(" "); ps(t...); }
 
void DBG() { cerr << "]" << endl; }
template<class H, class... T> void DBG(H h, T... t) {cerr << ts(h); if (sizeof...(t)) cerr << ", ";	DBG(t...); }

tcTU> void re(pair<T,U>& p);
tcT> void re(V<T>& v);
tcT, size_t SZ> void re(AR<T,SZ>& a);

tcT> void re(T& x) { cin >> x; }
void re(double& d) { str t; re(t); d = stod(t); }
void re(long double& d) { str t; re(t); d = stold(t); }
tcTUU> void re(T& t, U&... u) { re(t); re(u...); }

tcTU> void re(pair<T,U>& p) { re(p.first,p.second); }
tcT> void re(V<T>& x) { each(a,x) re(a); }
tcT, size_t SZ> void re(AR<T,SZ>& x) { each(a,x) re(a); }
tcT> void rv(int n, V<T>& x) { x.rsz(n); re(x); }

constexpr bool multitest() {return 1;}
void solve();
int main() {
	ios_base::sync_with_stdio(false); cin.tie(NULL);
	int t = 1;
	if (multitest()) cin >> t;
	for (; t; t--) solve();
}

















#define int long long


int xxx, yyy;
int n;
int queries;

int dist(int a, int b) {
	if (a > b) swap(a,b);
	return min(b-a, a+n-b);
}

int ask(int a, int b) {
	queries++;
#ifndef LOCAL
	cout << "? " << a+1 << " " << b+1 << endl;
	int ret; cin >> ret;
	return ret;
#else
	int ret = dist(a,b);
	ctmin(ret, dist(a,xxx)+1+dist(b,yyy));
	ctmin(ret, dist(a,yyy)+1+dist(b,xxx));
	//dbg("ask", a, b, ret);
	return ret;
#endif
}

int guess(int a, int b) {
	if (a > b) swap(a,b);
#ifndef LOCAL
	cout << "! " << a+1 << " " << b+1 << endl;
	int r; cin >> r;
	return r;
#else
	//dbg(queries);
	//dbg("guess", a, b);
	if (a == xxx && b == yyy) return 1;
	return -1;
#endif
}

void solve() {
#ifdef LOCAL
	n = 4;
#else
	re(n);
#endif
	queries = 0;

#ifdef LOCAL
	//xxx = rand()%n, yyy = rand()%n;
	xxx = uniform_int_distribution<int>(0,n-1)(rng); yyy = (xxx+n/2-1)%n;
	while (xxx == yyy || (xxx+1)%n == yyy || (xxx+n-1)%n == yyy) yyy = uniform_int_distribution<int>(0,n-1)(rng);//yyy = rand()%n;
	if (xxx > yyy) swap(xxx,yyy);
	//dbg("ans = ", xxx, yyy);
#endif

	int x, y;
	int ret;
	while (true) {
		x = uniform_int_distribution<int>(0, n-1)(rng);
		y = (x+(n/2)) % n;
		if (x > y) swap(x,y);
		ret = ask(x,y);
		if (ret != dist(x,y)) break;
	}

	if (ask(x+1,y) == ret-1) {
		x++;
		ret--;

		int st = 0, ed = ret-1;
		while (st < ed) {
			int m = (st+ed+1)/2;
			int tret = ask(x+m, y);

			if (tret == ret - m) st = m;
			else ed = m-1;
		}

		x += st;
		ret -= st;
	}
	else if (ask( (x+n-1)%n , y) == ret-1) {
		x=(x+n-1)%n;
		ret--;

		int st = 0, ed = ret-1;
		while (st < ed) {
			int m = (st+ed+1)/2;
			int tret = ask( (x+n-m)%n, y );

			if (tret == ret - m) st = m;
			else ed = m-1;
		}

		x = (x+n-st)%n;
		ret -= st;
	}

	if (ask(x, (y+n+ret-1)%n) == 1) y=(y+n+ret-1)%n;
	else y = (y+n-ret+1)%n;

	if (queries > 40 || guess(x,y) != 1) {
		ps("OH NO");
		exit(0);
	}
}


















































	







Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

2
6
3
2
1
1
1
4
2
2
2
1
1
1
1
1

output:

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

result:

ok ok (2 test cases)

Test #2:

score: 0
Accepted
time: 15ms
memory: 3600kb

input:

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

output:

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

result:

ok ok (1000 test cases)

Test #3:

score: 0
Accepted
time: 19ms
memory: 3892kb

input:

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

output:

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

result:

ok ok (1000 test cases)

Test #4:

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

input:

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

output:

? 13 25
? 14 25
? 12 25
? 8 25
? 6 25
? 5 25
? 6 1
! 1 6
? 13 25
? 14 25
? 12 25
? 10 25
? 9 25
? 9 25
! 9 25
? 6 18
? 7 18
? 5 18
? 6 23
! 6 23
? 6 18
? 7 18
? 5 18
? 25 18
? 3 18
? 2 18
? 3 25
! 3 11
? 10 23
? 11 23
? 16 23
? 19 23
? 17 23
? 18 23
? 18 26
! 18 20
? 11 24
? 12 24
? 10 24
? 7 24
? 6...

result:

ok ok (1000 test cases)

Test #5:

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

input:

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

output:

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

result:

ok ok (1000 test cases)

Test #6:

score: 0
Accepted
time: 16ms
memory: 3656kb

input:

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

output:

? 7 23
? 15 31
? 16 31
? 14 31
? 8 31
? 11 31
? 10 31
? 9 31
? 9 5
! 5 9
? 5 20
? 6 20
? 4 20
? 28 20
? 25 20
? 27 20
? 28 26
! 26 28
? 9 25
? 10 25
? 8 25
? 9 26
! 9 26
? 9 25
? 4 19
? 5 19
? 3 19
? 4 23
! 4 15
? 6 22
? 7 22
? 5 22
? 3 22
? 2 22
? 3 23
! 3 21
? 8 24
? 9 24
? 7 24
? 4 24
? 2 24
? 1 ...

result:

ok ok (1000 test cases)

Test #7:

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

input:

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

output:

? 6 23
? 7 23
? 5 23
? 1 23
? 3 23
? 4 23
? 5 31
! 5 31
? 16 33
? 17 33
? 15 33
? 12 33
? 14 33
? 15 6
! 6 15
? 10 26
? 11 26
? 9 26
? 2 26
? 32 26
? 30 26
? 31 26
? 31 28
! 24 31
? 16 33
? 17 33
? 15 33
? 12 33
? 11 33
? 10 33
? 11 34
! 11 32
? 1 18
? 2 18
? 7 18
? 4 18
? 3 18
? 2 27
! 2 27
? 13 30...

result:

ok ok (1000 test cases)

Test #8:

score: 0
Accepted
time: 12ms
memory: 3684kb

input:

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

output:

? 11 29
? 12 29
? 20 29
? 16 29
? 18 29
? 19 29
? 18 2
! 18 20
? 8 26
? 9 26
? 7 26
? 35 26
? 31 26
? 33 26
? 34 26
? 35 33
! 19 35
? 6 24
? 7 24
? 5 24
? 33 24
? 1 24
? 3 24
? 4 24
? 4 2
! 4 10
? 4 22
? 5 22
? 3 22
? 36 22
? 2 22
? 3 27
! 3 17
? 5 23
? 6 23
? 11 23
? 8 23
? 7 23
? 6 32
! 6 32
? 5 2...

result:

ok ok (1000 test cases)

Test #9:

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

input:

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

output:

? 18 36
? 19 36
? 17 36
? 11 36
? 14 36
? 13 36
? 14 8
! 14 27
? 4 22
? 5 22
? 3 22
? 31 22
? 27 22
? 29 22
? 28 22
? 28 26
! 26 28
? 14 33
? 15 33
? 23 33
? 19 33
? 17 33
? 18 33
? 18 7
! 7 18
? 4 23
? 5 23
? 10 23
? 13 23
? 14 23
? 13 25
! 13 21
? 9 27
? 10 27
? 15 27
? 17 27
? 18 27
? 19 27
? 19 ...

result:

ok ok (1000 test cases)

Test #10:

score: 0
Accepted
time: 6ms
memory: 3884kb

input:

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

output:

? 15 35
? 16 35
? 14 35
? 8 35
? 11 35
? 13 35
? 12 35
? 13 6
! 13 25
? 18 37
? 19 37
? 22 37
? 20 37
? 21 37
? 21 3
! 21 33
? 13 32
? 14 32
? 18 32
? 16 32
? 15 32
? 15 38
! 15 26
? 15 35
? 16 35
? 14 35
? 9 35
? 12 35
? 11 35
? 10 35
? 10 2
! 2 10
? 15 34
? 16 34
? 23 34
? 19 34
? 21 34
? 22 34
? ...

result:

ok ok (1000 test cases)

Test #11:

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

input:

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

output:

? 6 26
? 7 26
? 7 26
! 7 26
? 1 21
? 2 21
? 10 21
? 14 21
? 12 21
? 13 21
? 12 27
! 12 27
? 19 39
? 20 39
? 29 39
? 33 39
? 35 39
? 34 39
? 33 3
! 3 33
? 10 30
? 11 30
? 18 30
? 14 30
? 16 30
? 15 30
? 14 1
! 1 14
? 6 26
? 5 25
? 20 40
? 21 40
? 28 40
? 24 40
? 22 40
? 23 40
? 23 12
! 23 28
? 5 25
?...

result:

ok ok (1000 test cases)

Test #12:

score: 0
Accepted
time: 13ms
memory: 3624kb

input:

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

output:

? 16 37
? 17 37
? 23 37
? 20 37
? 18 37
? 17 6
! 6 17
? 18 38
? 19 38
? 26 38
? 30 38
? 32 38
? 33 38
? 33 38
! 33 38
? 11 32
? 12 32
? 18 32
? 15 32
? 16 32
? 17 32
? 16 40
! 16 40
? 3 24
? 4 24
? 2 24
? 35 24
? 39 24
? 37 24
? 36 24
? 36 32
! 16 36
? 9 30
? 10 30
? 14 30
? 12 30
? 11 30
? 10 37
! ...

result:

ok ok (1000 test cases)

Test #13:

score: 0
Accepted
time: 4ms
memory: 3596kb

input:

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

output:

? 7 28
? 8 28
? 6 28
? 1 28
? 4 28
? 3 28
? 2 28
? 3 35
! 3 21
? 8 29
? 9 29
? 17 29
? 13 29
? 15 29
? 16 29
? 16 38
! 16 20
? 1 22
? 2 22
? 4 22
? 5 22
? 6 22
? 5 23
! 5 21
? 12 33
? 13 33
? 15 33
? 14 33
? 14 35
! 14 35
? 14 36
? 15 36
? 13 36
? 7 36
? 4 36
? 6 36
? 5 36
? 5 40
! 5 40
? 3 24
? 12 ...

result:

ok ok (1000 test cases)

Test #14:

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

input:

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

output:

? 16 38
? 17 38
? 15 38
? 9 38
? 6 38
? 4 38
? 5 38
? 6 41
! 6 41
? 10 32
? 11 32
? 9 32
? 5 32
? 3 32
? 4 32
? 5 35
! 5 29
? 9 31
? 20 42
? 21 42
? 26 42
? 23 42
? 24 42
? 25 42
? 24 5
! 24 36
? 19 41
? 20 41
? 18 41
? 11 41
? 15 41
? 17 41
? 18 11
! 18 28
? 2 24
? 3 24
? 1 24
? 2 40
! 2 40
? 10 32...

result:

ok ok (1000 test cases)

Test #15:

score: 0
Accepted
time: 4ms
memory: 3712kb

input:

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

output:

? 3 26
? 12 35
? 13 35
? 11 35
? 3 35
? 7 35
? 5 35
? 4 35
? 5 45
! 5 45
? 10 33
? 11 33
? 16 33
? 13 33
? 12 33
? 12 42
! 12 42
? 13 35
? 14 35
? 24 35
? 19 35
? 16 35
? 17 35
? 18 35
? 18 5
! 5 18
? 7 29
? 8 29
? 6 29
? 4 29
? 5 29
? 6 32
! 6 32
? 22 45
? 23 45
? 21 45
? 16 45
? 14 45
? 13 45
? 14...

result:

ok ok (1000 test cases)

Test #16:

score: 0
Accepted
time: 13ms
memory: 3624kb

input:

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

output:

? 11 34
? 12 34
? 10 34
? 11 37
! 11 31
? 21 44
? 22 44
? 29 44
? 32 44
? 30 44
? 29 4
! 4 29
? 10 33
? 11 33
? 9 33
? 5 33
? 7 33
? 6 33
? 7 39
! 7 39
? 17 40
? 18 40
? 16 40
? 7 40
? 12 40
? 10 40
? 11 40
? 11 6
! 6 11
? 21 44
? 22 44
? 20 44
? 18 44
? 19 44
? 20 1
! 1 20
? 8 31
? 9 31
? 12 31
? 1...

result:

ok ok (1000 test cases)

Test #17:

score: 0
Accepted
time: 27ms
memory: 3656kb

input:

1000
1000000000
499999999
499999999
499999998
249999999
125000001
187500000
156250001
171875001
179687500
175781251
177734376
178710938
178222658
178466799
178588869
178649903
178619387
178634646
178642275
178646090
178647997
178648951
178649428
178649666
178649784
178649725
178649696
178649711
1786...

output:

? 193397661 693397661
? 193397662 693397661
? 193397660 693397661
? 943397661 693397661
? 818397662 693397661
? 880897662 693397661
? 849647662 693397661
? 865272662 693397661
? 873085162 693397661
? 869178912 693397661
? 871132037 693397661
? 872108600 693397661
? 871620319 693397661
? 871864460 69...

result:

ok ok (1000 test cases)

Test #18:

score: 0
Accepted
time: 17ms
memory: 3652kb

input:

1000
1000000000
499999969
499999968
250000015
374999976
312499980
281250013
296875012
304687512
308593731
306640637
307617200
308105481
308349622
308471692
308532696
308502179
308486920
308479322
308483106
308481230
308482184
308482630
308482423
308482542
308482602
308482632
308482636
308482629
3084...

output:

? 211733530 711733530
? 211733531 711733530
? 461733515 711733530
? 336733523 711733530
? 399233519 711733530
? 430483517 711733530
? 414858518 711733530
? 407046018 711733530
? 403139768 711733530
? 405092893 711733530
? 404116330 711733530
? 403628049 711733530
? 403383908 711733530
? 403261838 71...

result:

ok ok (1000 test cases)

Test #19:

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

input:

1000
1000000000
162479299
162479300
162479298
81239651
121859474
101549562
91394606
86317128
83778389
82509019
81874334
81556992
81398321
81318985
81279317
81259483
81249566
81244608
81242129
81240889
81240269
81239959
81239804
81239727
81239688
81239669
81239659
81239654
81239652
81239651
81239650
...

output:

? 318313745 818313745
? 318313746 818313745
? 318313744 818313745
? 237074095 818313745
? 277693920 818313745
? 257384008 818313745
? 247229052 818313745
? 242151574 818313745
? 239612835 818313745
? 238343465 818313745
? 237708780 818313745
? 237391438 818313745
? 237232767 818313745
? 237153431 81...

result:

ok ok (1000 test cases)

Test #20:

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

input:

1000
1000000000
36622908
36622909
36622907
18311526
27467181
22889318
20600386
19455920
18883687
18597571
18454513
18382984
18347219
18329337
18320396
18315925
18313690
18312572
18312013
18311734
18311594
18311524
18311491
18311507
18311498
18311494
18311492
18311491
18311490
36622979
1
1000000000
6...

output:

? 403068764 903068764
? 403068765 903068764
? 403068763 903068764
? 384757310 903068764
? 393913037 903068764
? 389335174 903068764
? 387046242 903068764
? 385901776 903068764
? 385329543 903068764
? 385043427 903068764
? 384900369 903068764
? 384828840 903068764
? 384793075 903068764
? 384775193 90...

result:

ok ok (1000 test cases)

Test #21:

score: 0
Accepted
time: 62ms
memory: 3624kb

input:

1000
1000000000
288090905
288090906
288090904
144045452
200752844
164741481
146735799
137732958
139544032
137293322
136607603
136730645
136449306
136466933
136396598
136414139
136396556
136387806
136392160
136389962
136388863
136388314
136388039
136387902
136387833
136387799
136387788
136387791
1363...

output:

? 109831071 609831071
? 109831072 609831071
? 109831070 609831071
? 965785618 609831071
? 893762892 609831071
? 929774255 609831071
? 947779937 609831071
? 956782778 609831071
? 961284198 609831071
? 959033488 609831071
? 957908133 609831071
? 958470811 609831071
? 958189472 609831071
? 958048803 60...

result:

ok ok (1000 test cases)

Test #22:

score: -100
Wrong Answer
time: 18ms
memory: 3652kb

input:

1000
999999999
499999999
499999999
499999999
499999999
499999999
499999998
499999999
499999997
249999999
125000001
187500001
218750001
234375000
226562500
222656251
224609375
223632814
224121094
223876955
223999025
224060059
224029543
224044801
224037172
224033358
224035266
224036219
224035742
22403...

output:

? 447828533 947828532
? 134614112 634614112
? 87777278 587777278
? 224302208 724302207
? 162027852 662027852
? 494582932 994582932
? 494582933 994582932
? 494582931 994582932
? 244582933 994582932
? 119582934 994582932
? 182082934 994582932
? 213332934 994582932
? 228957934 994582932
? 221145434 994...

result:

wrong answer Too many queries: 41 (test case 488)