QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#854695#9734. Identify Chorducup-team3099#WA 20ms3904kbC++205.4kb2025-01-12 06:02:462025-01-12 06:02:51

Judging History

This is the latest submission verdict.

  • [2025-01-12 06:02:51]
  • Judged
  • Verdict: WA
  • Time: 20ms
  • Memory: 3904kb
  • [2025-01-12 06:02:46]
  • 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();
}




















int xxx, yyy;
int n;

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) {
#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("guess", a, b);
	if (a == xxx && b == yyy) return 1;
	return -1;
#endif
}

void solve() {
	re(n);

#ifdef LOCAL
	//xxx = rand()%n, yyy = rand()%n;
	xxx = 999999999%n, yyy = 1;
	while (xxx == yyy || (xxx+1)%n == yyy || (xxx+n-1)%n == yyy) 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(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 (guess(x,y) != 1) {
		ps("OH NO");
		exit(0);
	}
}


















































	







详细

Test #1:

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

input:

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

output:

? 1 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: 3ms
memory: 3720kb

input:

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

output:

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

result:

ok ok (1000 test cases)

Test #3:

score: 0
Accepted
time: 11ms
memory: 3828kb

input:

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

output:

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

result:

ok ok (1000 test cases)

Test #4:

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

input:

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

output:

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

result:

ok ok (1000 test cases)

Test #5:

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

input:

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

output:

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

result:

ok ok (1000 test cases)

Test #6:

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

input:

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

output:

? 10 26
? 11 26
? 9 26
? 3 26
? 6 26
? 8 26
? 9 5
! 5 9
? 15 30
? 16 30
? 22 30
? 25 30
? 27 30
? 26 30
? 26 2
! 26 28
? 12 28
? 13 28
? 11 28
? 9 28
? 8 28
? 9 30
! 9 26
? 5 21
? 6 21
? 4 21
? 1 21
? 3 21
? 4 27
! 4 15
? 5 21
? 6 21
? 4 21
? 3 21
? 3 21
! 3 21
? 6 22
? 7 22
? 5 22
? 3 22
? 2 22
? 1...

result:

ok ok (1000 test cases)

Test #7:

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

input:

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

output:

? 17 34
? 18 34
? 16 34
? 9 34
? 5 34
? 3 34
? 4 34
? 5 3
! 5 31
? 17 33
? 18 33
? 16 33
? 12 33
? 14 33
? 15 33
? 15 6
! 6 15
? 11 27
? 13 29
? 14 29
? 20 29
? 23 29
? 25 29
? 24 29
? 24 31
! 24 31
? 13 30
? 14 30
? 12 30
? 10 30
? 11 30
? 11 32
! 11 32
? 17 34
? 18 34
? 24 34
? 27 34
? 28 34
? 27 ...

result:

ok ok (1000 test cases)

Test #8:

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

input:

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

output:

? 10 28
? 11 28
? 19 28
? 15 28
? 17 28
? 18 28
? 18 36
! 18 20
? 13 31
? 14 31
? 19 31
? 21 31
? 20 31
? 19 35
! 19 35
? 1 19
? 2 19
? 8 19
? 5 19
? 3 19
? 4 19
? 4 28
! 4 10
? 3 21
? 4 21
? 2 21
? 3 25
! 3 17
? 12 30
? 13 30
? 11 30
? 7 30
? 5 30
? 6 30
? 6 32
! 6 32
? 7 25
? 8 25
? 11 25
? 9 25
?...

result:

ok ok (1000 test cases)

Test #9:

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

input:

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

output:

? 16 35
? 17 35
? 15 35
? 10 35
? 13 35
? 14 35
? 14 6
! 14 27
? 1 19
? 2 19
? 36 19
? 28 19
? 24 19
? 26 19
? 27 19
? 28 26
! 26 28
? 4 23
? 5 23
? 9 23
? 7 23
? 8 23
? 7 28
! 7 18
? 18 36
? 12 31
? 13 31
? 18 31
? 15 31
? 14 31
? 13 4
! 13 21
? 4 22
? 17 35
? 18 35
? 23 35
? 20 35
? 19 35
? 19 6
!...

result:

ok ok (1000 test cases)

Test #10:

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

input:

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

output:

? 18 38
? 15 35
? 16 35
? 14 35
? 8 35
? 11 35
? 13 35
? 12 35
? 13 6
! 13 25
? 7 26
? 8 26
? 6 26
? 36 26
? 32 26
? 34 26
? 33 26
? 33 31
! 21 33
? 19 38
? 20 38
? 18 38
? 10 38
? 14 38
? 16 38
? 15 38
? 15 12
! 15 26
? 11 30
? 12 30
? 10 30
? 4 30
? 7 30
? 9 30
? 10 2
! 2 10
? 15 34
? 16 34
? 23 3...

result:

ok ok (1000 test cases)

Test #11:

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

input:

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

output:

? 6 26
? 7 26
? 7 26
! 7 26
? 20 40
? 7 27
? 8 27
? 10 27
? 11 27
? 12 27
? 12 27
! 12 27
? 3 23
? 4 23
? 2 23
? 3 33
! 3 33
? 9 29
? 10 29
? 18 29
? 14 29
? 16 29
? 15 29
? 14 1
! 1 14
? 9 29
? 10 29
? 17 29
? 21 29
? 23 29
? 24 29
? 23 30
! 23 28
? 12 32
? 13 32
? 15 32
? 16 32
? 15 33
! 15 33
? 1...

result:

ok ok (1000 test cases)

Test #12:

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

input:

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

output:

? 20 41
? 21 41
? 19 41
? 14 41
? 17 41
? 16 41
? 17 6
! 6 17
? 14 35
? 11 31
? 12 31
? 10 31
? 2 31
? 39 31
? 37 31
? 38 31
? 38 33
! 33 38
? 19 39
? 20 39
? 18 39
? 16 39
? 15 39
? 16 40
! 16 40
? 4 24
? 5 24
? 3 24
? 36 24
? 32 24
? 34 24
? 35 24
? 36 32
! 16 36
? 8 29
? 9 29
? 13 29
? 11 29
? 10...

result:

ok ok (1000 test cases)

Test #13:

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

input:

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

output:

? 5 27
? 6 27
? 4 27
? 43 27
? 2 27
? 3 27
? 3 33
! 3 21
? 19 40
? 20 40
? 29 40
? 24 40
? 22 40
? 21 40
? 20 16
! 16 20
? 14 35
? 1 23
? 2 23
? 5 23
? 6 23
? 5 25
! 5 21
? 5 26
? 6 26
? 15 26
? 10 26
? 12 26
? 13 26
? 14 26
? 14 35
! 14 35
? 11 32
? 12 32
? 10 32
? 3 32
? 7 32
? 5 32
? 4 32
? 5 40
...

result:

ok ok (1000 test cases)

Test #14:

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

input:

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

output:

? 19 41
? 20 41
? 18 41
? 12 41
? 9 41
? 7 41
? 6 41
? 6 41
! 6 41
? 10 32
? 11 32
? 9 32
? 5 32
? 3 32
? 4 32
? 5 35
! 5 29
? 21 42
? 22 42
? 26 42
? 24 42
? 25 42
? 24 5
! 24 36
? 14 35
? 15 35
? 20 35
? 17 35
? 18 35
? 19 35
? 18 42
! 18 28
? 2 24
? 3 24
? 1 24
? 2 40
! 2 40
? 15 37
? 16 37
? 14 ...

result:

ok ok (1000 test cases)

Test #15:

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

input:

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

output:

? 16 39
? 17 39
? 15 39
? 7 39
? 3 39
? 5 39
? 4 39
? 5 45
! 5 45
? 6 29
? 7 29
? 16 29
? 11 29
? 13 29
? 12 29
? 12 42
! 12 42
? 4 26
? 5 26
? 9 26
? 7 26
? 6 26
? 5 34
! 5 18
? 21 43
? 22 43
? 31 43
? 36 43
? 33 43
? 32 43
? 32 6
! 6 32
? 11 33
? 12 33
? 20 33
? 16 33
? 14 33
? 15 33
? 14 2
! 2 14...

result:

ok ok (1000 test cases)

Test #16:

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

input:

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

output:

? 9 32
? 10 32
? 11 32
? 12 32
? 11 33
! 11 31
? 13 36
? 14 36
? 12 36
? 4 36
? 46 36
? 2 36
? 3 36
? 4 43
! 4 29
? 11 34
? 12 34
? 10 34
? 6 34
? 8 34
? 7 34
? 7 39
! 7 39
? 6 29
? 7 29
? 5 29
? 6 1
! 6 11
? 18 41
? 19 41
? 23 41
? 21 41
? 20 41
? 20 1
! 1 20
? 18 41
? 19 41
? 17 41
? 10 41
? 14 41...

result:

ok ok (1000 test cases)

Test #17:

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

input:

1000
1000000000
499999999
499999999
499999998
249999999
125000001
187500001
218750001
234375001
242187500
238281251
240234375
239257813
238769533
239013674
239135743
239074709
239105226
239089967
239082338
239078524
239080432
239081385
239080909
239081148
239081266
239081207
239081177
239081163
2390...

output:

? 132966216 632966216
? 132966217 632966216
? 132966215 632966216
? 882966216 632966216
? 757966217 632966216
? 820466217 632966216
? 851716217 632966216
? 867341217 632966216
? 875153717 632966216
? 871247467 632966216
? 873200592 632966216
? 872224030 632966216
? 871735749 632966216
? 871979890 63...

result:

wrong answer Integer -984171401 violates the range [1, 10^9] (test case 4)