QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#854722#9734. Identify Chorducup-team3099#WA 38ms3816kbC++206.0kb2025-01-12 06:50:182025-01-12 06:50:19

Judging History

This is the latest submission verdict.

  • [2025-01-12 06:50:19]
  • Judged
  • Verdict: WA
  • Time: 38ms
  • Memory: 3816kb
  • [2025-01-12 06:50:18]
  • Submitted

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;
map<pair<int,int>, int> resps;

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) {
	if (a > b) swap(a,b);
	if (resps.find(pair<int,int>{a,b}) != resps.end()) return resps.find(pair<int,int>{a,b})->second;

	queries++;
#ifndef LOCAL
	cout << "? " << a+1 << " " << b+1 << endl;
	int ret; cin >> ret;
	return resps[pair<int,int>{a,b}]=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 resps[pair<int,int>{a,b}]=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 = 999999999;
#else
	re(n);
#endif
	resps.clear();
	queries = 0;

#ifdef LOCAL
	//xxx = rand()%n, yyy = rand()%n;
	xxx = uniform_int_distribution<int>(0,n-1)(rng); yyy = uniform_int_distribution<int>(0,n-1)(rng);//(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 = uniform_int_distribution<int>(0, n-1)(rng);
	int y;
	int ret;
	while (true) {
		y = (x+n/2)%n;
		while (x == y || (x+1)%n == y || (x+n-1)%n == y) y = uniform_int_distribution<int>(0,n-1)(rng);
		ret = ask(x,y);
		if (ret != dist(x,y)) break;
		x=(x+1)%n;
	}

	if (x > y) swap(x,y);

	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");
		dbg(queries);
		exit(0);
	}
}


















































	







详细

Test #1:

score: 100
Accepted
time: 0ms
memory: 3548kb

input:

2
6
3
2
1
1
4
1
1
1
1

output:

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

result:

ok ok (2 test cases)

Test #2:

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

input:

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

output:

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

result:

ok ok (1000 test cases)

Test #3:

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

input:

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

output:

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

result:

ok ok (1000 test cases)

Test #4:

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

input:

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

output:

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

result:

ok ok (1000 test cases)

Test #5:

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

input:

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

output:

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

result:

ok ok (1000 test cases)

Test #6:

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

input:

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

output:

? 3 19
? 4 19
? 10 19
? 7 19
? 5 19
? 6 19
? 5 29
! 5 9
? 12 27
? 13 28
? 14 28
? 20 28
? 23 28
? 25 28
? 26 28
! 26 28
? 1 17
? 2 18
? 3 19
? 4 19
? 10 19
? 7 19
? 8 19
? 9 19
? 9 26
! 9 26
? 5 20
? 6 20
? 4 20
? 1 20
? 3 20
? 4 25
! 4 15
? 1 17
? 2 17
? 5 17
? 3 17
? 4 17
? 3 21
! 3 21
? 16 32
? 1...

result:

ok ok (1000 test cases)

Test #7:

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

input:

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

output:

? 6 23
? 7 23
? 5 23
? 1 23
? 3 23
? 4 23
? 5 31
! 5 31
? 13 29
? 14 29
? 20 29
? 17 29
? 15 29
? 16 29
? 6 15
! 6 15
? 8 24
? 9 24
? 7 24
? 2 24
? 24 33
? 24 32
? 24 31
! 24 31
? 7 24
? 8 24
? 14 24
? 11 24
? 12 24
? 11 32
! 11 32
? 13 30
? 14 30
? 12 30
? 5 30
? 2 30
? 30 34
? 1 30
? 2 33
! 2 27
?...

result:

ok ok (1000 test cases)

Test #8:

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

input:

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

output:

? 11 29
? 12 29
? 20 29
? 16 29
? 18 29
? 19 29
? 2 18
! 18 20
? 2 20
? 3 20
? 1 20
? 20 35
? 20 34
? 21 35
! 19 35
? 15 33
? 16 33
? 14 33
? 8 33
? 11 33
? 10 33
? 9 33
? 4 10
! 4 10
? 16 34
? 17 34
? 20 34
? 18 34
? 3 17
! 3 17
? 17 35
? 18 35
? 16 35
? 9 35
? 6 35
? 4 35
? 5 35
? 2 6
! 6 32
? 7 2...

result:

ok ok (1000 test cases)

Test #9:

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

input:

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

output:

? 3 22
? 4 22
? 12 22
? 16 22
? 14 22
? 15 22
? 14 27
! 14 27
? 5 23
? 6 23
? 4 23
? 23 32
? 23 28
? 23 26
? 23 27
? 26 28
! 26 28
? 15 34
? 16 34
? 23 34
? 19 34
? 17 34
? 18 34
? 7 18
! 7 18
? 6 25
? 7 25
? 12 25
? 15 25
? 13 25
? 14 25
? 13 29
! 13 21
? 12 30
? 13 30
? 18 30
? 20 30
? 19 30
? 19 ...

result:

ok ok (1000 test cases)

Test #10:

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

input:

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

output:

? 2 21
? 3 21
? 10 21
? 14 21
? 12 21
? 13 21
? 13 25
! 13 25
? 4 23
? 5 23
? 3 23
? 23 36
? 23 33
? 23 32
? 25 33
! 21 33
? 10 29
? 11 29
? 15 29
? 17 29
? 16 29
? 15 32
! 15 26
? 8 27
? 9 27
? 17 27
? 13 27
? 11 27
? 10 27
? 2 10
! 2 10
? 11 30
? 12 30
? 19 30
? 22 30
? 20 30
? 21 30
? 21 34
! 21 ...

result:

ok ok (1000 test cases)

Test #11:

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

input:

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

output:

? 4 24
? 5 24
? 7 24
? 8 24
? 7 26
! 7 26
? 15 35
? 16 35
? 14 35
? 9 35
? 12 35
? 11 35
? 3 12
! 12 27
? 4 24
? 5 24
? 3 24
? 24 38
? 1 24
? 2 24
? 3 33
! 3 33
? 2 22
? 3 22
? 1 22
? 22 37
? 22 39
? 22 40
? 1 30
! 1 14
? 1 21
? 2 21
? 21 40
? 21 33
? 21 29
? 21 27
? 21 28
? 23 28
! 23 28
? 11 31
? ...

result:

ok ok (1000 test cases)

Test #12:

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

input:

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

output:

? 4 25
? 5 25
? 10 25
? 7 25
? 6 25
? 6 33
! 6 17
? 5 26
? 6 26
? 4 26
? 26 38
? 26 34
? 26 36
? 26 37
? 33 38
! 33 38
? 15 36
? 16 36
? 18 36
? 17 36
? 16 40
! 16 40
? 18 38
? 19 38
? 17 38
? 15 38
? 16 38
? 16 40
! 16 36
? 12 32
? 13 32
? 11 32
? 6 32
? 9 32
? 10 32
? 10 41
! 10 23
? 15 36
? 16 36...

result:

ok ok (1000 test cases)

Test #13:

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

input:

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

output:

? 7 28
? 8 28
? 6 28
? 1 28
? 4 28
? 3 28
? 2 28
? 3 35
! 3 21
? 3 24
? 4 24
? 12 24
? 16 24
? 18 24
? 17 24
? 16 28
! 16 20
? 22 43
? 23 43
? 21 43
? 18 43
? 20 43
? 5 21
! 5 21
? 1 23
? 2 23
? 23 43
? 23 34
? 23 39
? 23 37
? 23 36
? 23 35
? 32 35
! 14 35
? 19 40
? 20 40
? 18 40
? 11 40
? 8 40
? 6 ...

result:

ok ok (1000 test cases)

Test #14:

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

input:

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

output:

? 18 40
? 19 40
? 17 40
? 11 40
? 8 40
? 6 40
? 5 40
? 6 41
! 6 41
? 13 35
? 14 35
? 12 35
? 5 35
? 2 35
? 4 35
? 5 41
! 5 29
? 15 37
? 16 37
? 21 37
? 23 37
? 24 37
? 25 37
? 24 38
! 24 36
? 18 40
? 19 40
? 17 40
? 9 18
! 18 28
? 2 24
? 3 24
? 1 24
? 2 40
! 2 40
? 10 32
? 11 32
? 20 32
? 15 32
? 13...

result:

ok ok (1000 test cases)

Test #15:

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

input:

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

output:

? 8 31
? 9 31
? 7 31
? 31 44
? 3 31
? 5 31
? 4 31
? 5 45
! 5 45
? 15 38
? 16 38
? 14 38
? 11 38
? 13 38
? 12 38
? 12 42
! 12 42
? 10 33
? 11 33
? 9 33
? 33 44
? 4 33
? 7 33
? 6 33
? 5 33
? 3 5
! 5 18
? 13 35
? 14 35
? 12 35
? 7 35
? 5 35
? 6 35
? 6 38
! 6 32
? 21 43
? 22 43
? 20 43
? 15 43
? 12 43
?...

result:

ok ok (1000 test cases)

Test #16:

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

input:

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

output:

? 23 46
? 24 46
? 33 46
? 28 46
? 30 46
? 31 46
? 32 46
? 11 31
! 11 31
? 8 31
? 9 31
? 7 31
? 4 31
? 3 31
? 4 33
! 4 29
? 8 31
? 9 31
? 7 31
? 3 31
? 5 31
? 6 31
? 7 39
! 7 39
? 1 24
? 2 24
? 11 24
? 6 24
? 8 24
? 7 24
? 6 37
! 6 11
? 14 37
? 15 37
? 23 37
? 19 37
? 21 37
? 20 37
? 1 20
! 1 20
? 15...

result:

ok ok (1000 test cases)

Test #17:

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

input:

1000
1000000000
499999999
499999998
249999999
125000000
62500000
31250001
46875001
54687501
58593751
60546876
61523438
61035158
61279298
61157228
61096194
61126711
61111452
61103823
61100008
61098102
61099056
61099532
61099294
61099176
61099236
61099265
61099250
61099244
61099247
61099246
61099246
1...

output:

? 433146627 933146627
? 433146628 933146627
? 683146627 933146627
? 808146626 933146627
? 870646626 933146627
? 901896626 933146627
? 886271626 933146627
? 878459126 933146627
? 874552876 933146627
? 872599751 933146627
? 871623188 933146627
? 872111469 933146627
? 871867328 933146627
? 871989398 93...

result:

ok ok (1000 test cases)

Test #18:

score: 0
Accepted
time: 38ms
memory: 3620kb

input:

1000
1000000000
499999969
499999970
499999968
250000015
375000007
437499972
406250005
421874973
414062474
410156255
412109349
411132787
410644506
410400365
410278326
410339361
410369848
410354620
410362250
410366065
410367972
410368895
410368449
410368657
410368538
410368509
410368508
410368497
4103...

output:

? 492882379 992882379
? 492882380 992882379
? 492882378 992882379
? 242882394 992882379
? 367882386 992882379
? 430382382 992882379
? 399132384 992882379
? 414757383 992882379
? 406944884 992882379
? 403038634 992882379
? 404991759 992882379
? 404015197 992882379
? 403526916 992882379
? 403282775 99...

result:

ok ok (1000 test cases)

Test #19:

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

input:

1000
1000000000
130748663
130748662
65374333
98061497
81717914
73546123
69460227
67417279
66395805
65885068
65629700
65502016
65438174
65406253
65390292
65382312
65378322
65376327
65375329
65374830
65374581
65374456
65374394
65374363
65374347
65374339
65374335
65374333
65374332
1
1
1000000000
256635...

output:

? 171699765 671699765
? 171699766 671699765
? 237074097 671699765
? 204386931 671699765
? 220730514 671699765
? 228902305 671699765
? 232988201 671699765
? 235031149 671699765
? 236052623 671699765
? 236563360 671699765
? 236818728 671699765
? 236946412 671699765
? 237010254 671699765
? 237042175 67...

result:

ok ok (1000 test cases)

Test #20:

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

input:

1000
1000000000
22111418
22111417
11055709
16583493
13819566
12437602
11746620
11401129
11228384
11142011
11098825
11077232
11066435
11061037
11058338
11056988
11056313
11055976
11055807
11055723
11055681
11055688
11055678
11055675
11055676
11055675
11055674
1
1
1000000000
249444107
249444108
249444...

output:

? 373701602 873701602
? 373701603 873701602
? 384757311 873701602
? 390285165 873701602
? 387521238 873701602
? 386139274 873701602
? 385448292 873701602
? 385102801 873701602
? 384930056 873701602
? 384843683 873701602
? 384800497 873701602
? 384778904 873701602
? 384768107 873701602
? 384762709 87...

result:

ok ok (1000 test cases)

Test #21:

score: 0
Accepted
time: 28ms
memory: 3568kb

input:

1000
1000000000
288090905
288090906
288090904
144045452
171391064
135379701
126039771
126376860
121875439
123789061
122663706
122101029
121819690
121734769
121749356
121714189
121717185
121708393
121709793
121707595
121707294
121707046
121707019
121706909
121706950
121706915
121706898
121706901
1217...

output:

? 124511961 624511961
? 124511962 624511961
? 124511960 624511961
? 624511961 980466508
? 624511961 908443782
? 624511961 944455145
? 624511961 962460827
? 624511961 953457986
? 624511961 957959407
? 624511961 960210117
? 624511961 959084762
? 624511961 958522085
? 624511961 958240746
? 624511961 95...

result:

ok ok (1000 test cases)

Test #22:

score: -100
Wrong Answer
time: 1ms
memory: 3816kb

input:

1000
999999999
499999999
499999999
499999999
499999999
499999999
499999999
499999999
499999999
499999999
499999999
499999999
499999999
499999999
499999999
499999999
499999999
499999999
499999999
499999999
499999999
499999999
499999999
499999999
499999999
499999999
499999999
499999999
499999999
49999...

output:

? 90845874 590845874
? 90845875 590845875
? 90845876 590845876
? 90845877 590845877
? 90845878 590845878
? 90845879 590845879
? 90845880 590845880
? 90845881 590845881
? 90845882 590845882
? 90845883 590845883
? 90845884 590845884
? 90845885 590845885
? 90845886 590845886
? 90845887 590845887
? 9084...

result:

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