QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#882684#9734. Identify ChordrbtreeWA 71ms3712kbC++265.7kb2025-02-05 10:42:082025-02-05 10:42:15

Judging History

This is the latest submission verdict.

  • [2025-02-05 10:42:15]
  • Judged
  • Verdict: WA
  • Time: 71ms
  • Memory: 3712kb
  • [2025-02-05 10:42:08]
  • Submitted

answer

#include "bits/stdc++.h"
constexpr int __FREAD__ = 0;
constexpr char __FIN__[] = "";
constexpr char __FOUT__[] = "";
constexpr bool MTS = true;
constexpr bool SPC_MTS = false;
#define _LOAD_4(a, b, c, d, ...) d
#define _ALL_0(arg) begin(arg), end(arg)
#define _ALL_1(arg, l) (begin(arg) + (l)), end(arg)
#define _ALL_2(arg, l, r) (begin(arg) + (l)), (begin(arg) + (r) + 1)
#define ALL(...) _LOAD_4(__VA_ARGS__, _ALL_2, _ALL_1, _ALL_0)(__VA_ARGS__)

// :/

using namespace std;
using tp = long long int;
[[maybe_unused]] constexpr tp ZERO = 0, ONE = 1, INF = -1ull >> 2;
int WITHERING(int);
void MIST(int, char*[]);

template <typename _Ty> class _Lambda_t { _Ty lexp;public:template<typename __Ty
>_Lambda_t(__Ty&&lexp):lexp(static_cast<__Ty&&>(lexp)){}template<typename...__Ty
>decltype(auto)operator()(__Ty&&...args){return lexp(std::ref(*this),static_cast
<__Ty&&>(args)...); } }; template <typename _Ty> decltype (auto) lexp(_Ty&&l_exp
) {return _Lambda_t<typename std::decay<_Ty>::type>(static_cast<_Ty&&>(l_exp));}
struct SPLITMIX { static uint64_t splitmix(uint64_t x){x+=0x9e3779b97f4a7c15;x=(
x ^ (x >> 30)) * 0xbf58476d1ce4e5b9; x = (x ^ (x>>27))*0x94d049bb133111eb;return
x ^ (x >> 31); } size_t operator()(uint64_t x) const { static const uint64_t o =
chrono::steady_clock::now().time_since_epoch().count(); return splitmix(x+o);}};
template <typename _Ty> auto vcc(_Ty init, size_t s) { return std::vector<_Ty>(s
, init); } template <typename _Ty, typename... __Ty> auto vcc(_Ty init, size_t s
, __Ty... o) {auto ret=vcc(init,o...);return std::vector<decltype(ret)>(s,ret);}
template <typename _Ty1, typename _Ty2> bool ckmax(_Ty1& a, const _Ty2& b) { if(
a < b) { a = b; return true; } return false; } template <typename _Ty1, typename
_Ty2> bool ckmin(_Ty1& a, const _Ty2& b){if(b<a){a=b;return true;}return false;}
void RAW(char&x){if(__FREAD__!=0){static char buf[__FREAD__];static char*s=buf,*
e=buf;if(s==e){s=buf;e=buf+fread(buf,1,__FREAD__,stdin);if(s==e){x=EOF;return;}}
x = *s++; } else x = getchar(); } void bin(char& c){for(RAW(c);c==' '||c == '\n'
|| c == '\r'; RAW(c)); } void bin(std::string& x) { char c; for(RAW(c);c==' '||c
== '\n' || c == '\r'; RAW(c)); x = c; for (RAW(c); c!=' '&&c!='\n'&&c!='\r';RAW(
c)) x.push_back(c); } template <typename Ty> void bin(Ty& x) { bool sign = false
;char c; for (RAW(c); c < '0' || c > '9'; RAW(c)) if (c == '-') sign = true; for
(x = 0; '0' <= c && c <= '9'; RAW(c)) x = x * 10 + (c & 15); if (sign) x = -x; }
template <typename...> using bin_void_t =void;template<typename T,typename=void>
struct bin_it :std::false_type{};template<typename T>struct bin_it<T,bin_void_t<
typename std::iterator_traits<T>::iterator_category>>:std::true_type{};template<
typename T>struct bin_it<T*,void>:std::true_type{};template<typename T,typename=
typename std::enable_if<bin_it<T>::value>::type>void bin(T s,T e){while(s!=e)bin
(*s++);}template<typename...>struct bin_or:std::false_type{};template<typename T
, typename... O> struct bin_or<T,O...>:std::conditional<T::value,std::true_type,
bin_or<O...>>::type {}; template <typename... T>typename std::enable_if<!bin_or<
bin_it<typename std::decay<T>::type>...>::value, void>::type bin(T& ...x) {void(
(int[]) { 0, (bin(&x, &x + 1), 0) ... }); } tp bin() { tp x; cin>>x; return x; }
int main(int argc, char* argv[]) { int t = 0, _t = 1; if(MTS&&!SPC_MTS) bin(_t);
MIST(argc, argv); while(t<_t||SPC_MTS){if(WITHERING(++t)!=0)return 0;}return 0;}
#ifdef XCODE
#define bg(...){cout<<"["<<__LINE__<<'@'<<++_LT[__LINE__]<<':';BG(__VA_ARGS__);}
size_t _LT[21777]; template<typename _Type>void BG(const _Type&_cur){cout<<' '<<
_cur << ']' <<" <<:"<<std::endl;}template<typename _Type,typename... _Other>void
BG(const _Type& _cur, const _Other& ..._other) {cout<< ' '<<_cur;BG(_other...);}
#else
#define bg(...)
#endif

// :/

namespace lib {  // LIBLIBLIBLIBLIBLIBLIBLIBLIBLIBLIBLIBLIBLIBLIBLIBLIBLIBLIBLIB
class Random{mt19937_64 rd;public:Random(unsigned long long seed) {rd=mt19937_64
(seed); } long long operator()(long long l, long long r) { return l + rd() % (r-
l + 1); } } rng(reinterpret_cast<unsigned long long>(new char) * time(nullptr));
}  // LIB::RANDOM LIB::RANDOM LIB::RANDOM LIB::RANDOM LIB::RANDOM LIB::RANDOM LI

// :/

struct STRUGGLE {
   STRUGGLE() {
      if (strlen(__FIN__)) freopen(__FIN__, "r", stdin);
      if (strlen(__FOUT__)) freopen(__FOUT__, "w", stdout);
   }
   
   ~STRUGGLE() {
   }
} STRUGGLE;

int WITHERING([[maybe_unused]] int TEST_NUMBER) {
   int n; cin >> n;
   map<pair<int, int>, int> mem;
   auto ask = [&](int x, int y) {
      if ((x + 1) % n == y || (y + 1) % n == x) return 1;
      if (mem.count(minmax(x, y))) return mem[minmax(x, y)];
      cout << "? " << x + 1 << ' ' << y + 1 << endl;
      int t;
      cin >> t;
      return mem[minmax(x, y)] = t;
   };
   int x, y;
   int d;
   while (true) {
      x = lib::rng(0, n - 1);
      y = (x + n / 2) % n;
      d = ask(x, y);
      if (d != n / 2) break;
   }
   if (ask(x, (y + n - 1) % n) == d - 1) {
      int l = 1, r = n / 2;
      while (l <= r) {
         int mid = (l + r) >> 1;
         if (ask(x, (y + n - mid) % n) == d - mid) l = mid + 1;
         else r = mid - 1;
      }
      y = (y + n - r) % n;
   } else {
      int l = 1, r = n / 2;
      while (l <= r) {
         int mid = (l + r) >> 1;
         if (ask(x, (y + mid) % n) == d - mid) l = mid + 1;
         else r = mid - 1;
      }
      y = (y + r) % n;
   }
   d = ask(x, y);
   if (ask((x + d - 1) % n, y) == 1) x = (x + d - 1) % n;
   else x = (x + n - d + 1) % n;
   cout << "! " << x + 1 << ' ' << y + 1 << endl;
   cin >> x;
   return 0;
}

void MIST([[maybe_unused]] int argc, [[maybe_unused]] char* argv[]) {
}

// :\ */

详细

Test #1:

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

input:

2
6
2
2
2
2
1
4
1
1

output:

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

result:

ok ok (2 test cases)

Test #2:

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

input:

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

output:

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

result:

ok ok (1000 test cases)

Test #3:

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

input:

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

output:

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

result:

ok ok (1000 test cases)

Test #4:

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

input:

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

output:

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

result:

ok ok (1000 test cases)

Test #5:

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

input:

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

output:

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

result:

ok ok (1000 test cases)

Test #6:

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

input:

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

output:

? 1 17
? 1 16
? 1 9
? 1 5
? 1 7
? 1 8
? 5 9
! 5 9
? 15 30
? 15 29
? 15 22
? 15 26
? 15 28
? 15 27
? 26 28
! 26 28
? 20 4
? 20 3
? 20 12
? 20 8
? 20 10
? 20 9
? 26 9
! 26 9
? 23 7
? 23 6
? 23 30
? 23 3
? 23 5
? 23 4
? 31 4
! 15 4
? 13 29
? 13 28
? 13 5
? 13 1
? 13 3
? 13 4
? 21 3
! 21 3
? 4 20
? 4 19...

result:

ok ok (1000 test cases)

Test #7:

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

input:

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

output:

? 17 34
? 17 33
? 17 25
? 17 30
? 17 32
? 17 31
? 29 31
! 5 31
? 2 18
? 2 17
? 2 10
? 2 14
? 2 16
? 2 15
? 6 15
! 6 15
? 33 16
? 33 15
? 33 24
? 33 28
? 33 26
? 33 25
? 2 24
! 31 24
? 19 2
? 19 1
? 19 27
? 19 32
? 19 30
? 19 31
? 27 32
! 11 32
? 18 1
? 18 34
? 18 10
? 18 5
? 18 3
? 18 2
? 27 2
! 27 ...

result:

ok ok (1000 test cases)

Test #8:

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

input:

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

output:

? 27 9
? 27 8
? 27 18
? 27 23
? 27 20
? 27 19
? 34 18
! 20 18
? 18 36
? 18 35
? 18 27
? 18 32
? 18 34
? 19 35
! 19 35
? 22 4
? 22 3
? 22 13
? 22 8
? 22 6
? 22 5
? 34 4
! 10 4
? 9 27
? 9 26
? 9 18
? 9 13
? 9 16
? 9 17
? 15 17
! 3 17
? 32 14
? 32 13
? 32 5
? 32 10
? 32 8
? 32 7
? 32 6
! 32 6
? 15 33
?...

result:

ok ok (1000 test cases)

Test #9:

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

input:

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

output:

? 23 4
? 23 3
? 23 13
? 23 18
? 23 15
? 23 14
? 27 14
! 27 14
? 2 20
? 2 19
? 2 29
? 2 24
? 2 26
? 2 27
? 12 26
! 28 26
? 34 15
? 34 14
? 34 25
? 34 20
? 34 17
? 34 18
? 34 19
? 7 18
! 7 18
? 31 12
? 31 11
? 31 21
? 31 16
? 31 14
? 31 13
? 4 13
! 21 13
? 9 27
? 9 26
? 9 36
? 9 31
? 9 29
? 9 28
? 19 ...

result:

ok ok (1000 test cases)

Test #10:

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

input:

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

output:

? 34 14
? 34 13
? 34 4
? 34 9
? 34 12
? 4 13
! 25 13
? 33 14
? 33 13
? 33 24
? 33 19
? 33 21
? 33 22
! 33 21
? 5 24
? 5 23
? 5 34
? 5 29
? 5 26
? 5 27
? 15 26
! 15 26
? 33 13
? 33 12
? 33 3
? 33 8
? 33 11
? 33 10
? 33 9
? 2 10
! 2 10
? 22 3
? 22 2
? 22 31
? 22 26
? 22 24
? 22 25
? 23 26
! 21 26
? 3 ...

result:

ok ok (1000 test cases)

Test #11:

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

input:

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

output:

? 6 26
? 6 25
? 6 36
? 6 31
? 6 28
? 6 27
? 7 26
! 7 26
? 37 17
? 37 16
? 37 7
? 37 12
? 37 10
? 37 11
? 7 12
! 27 12
? 25 5
? 25 4
? 25 35
? 25 40
? 25 3
? 25 2
? 33 3
! 33 3
? 19 39
? 19 38
? 19 9
? 19 4
? 19 1
? 19 2
? 24 1
! 14 1
? 20 40
? 20 39
? 20 30
? 20 25
? 20 28
? 20 27
? 23 28
! 23 28
? ...

result:

ok ok (1000 test cases)

Test #12:

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

input:

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

output:

? 4 25
? 4 24
? 4 14
? 4 20
? 4 17
? 4 16
? 6 17
! 6 17
? 9 29
? 9 28
? 9 39
? 9 34
? 9 31
? 9 32
? 9 33
? 21 33
! 38 33
? 38 17
? 38 16
? 38 7
? 38 12
? 38 15
? 40 16
! 40 16
? 22 1
? 22 41
? 22 32
? 22 37
? 22 35
? 22 36
? 28 36
! 16 36
? 1 21
? 1 20
? 1 31
? 1 26
? 1 23
? 1 24
? 10 23
! 10 23
? 3...

result:

ok ok (1000 test cases)

Test #13:

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

input:

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

output:

? 7 28
? 7 27
? 7 17
? 7 23
? 7 20
? 7 22
? 7 21
? 11 21
! 3 21
? 15 36
? 15 35
? 15 25
? 15 20
? 15 17
? 15 19
? 16 20
! 16 20
? 36 14
? 36 13
? 36 25
? 36 19
? 36 22
? 36 20
? 36 21
? 5 21
! 5 21
? 17 38
? 17 37
? 17 27
? 17 33
? 17 36
? 17 35
? 17 34
? 20 35
! 14 35
? 1 22
? 8 29
? 8 28
? 8 40
? ...

result:

ok ok (1000 test cases)

Test #14:

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

input:

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

output:

? 28 6
? 28 5
? 28 17
? 28 11
? 28 8
? 28 7
? 41 6
! 41 6
? 29 7
? 29 6
? 29 40
? 29 2
? 29 5
? 29 4
! 29 5
? 36 14
? 36 13
? 36 25
? 36 19
? 36 22
? 36 23
? 36 24
! 36 24
? 7 28
? 7 27
? 7 39
? 7 33
? 7 30
? 7 29
? 18 28
! 18 28
? 30 8
? 30 7
? 30 41
? 30 3
? 30 44
? 30 2
? 30 1
? 40 2
! 40 2
? 13 ...

result:

ok ok (1000 test cases)

Test #15:

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

input:

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

output:

? 38 15
? 38 14
? 38 4
? 38 10
? 38 7
? 38 6
? 38 5
? 45 5
! 45 5
? 32 9
? 32 8
? 32 20
? 32 14
? 32 11
? 32 12
? 32 13
? 42 12
! 42 12
? 29 6
? 29 5
? 29 40
? 29 1
? 29 4
? 40 5
! 18 5
? 33 10
? 33 9
? 33 44
? 33 5
? 33 8
? 33 7
? 33 6
? 34 6
! 32 6
? 5 27
? 5 26
? 5 16
? 5 10
? 5 13
? 5 15
? 5 14
...

result:

ok ok (1000 test cases)

Test #16:

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

input:

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

output:

? 27 4
? 27 3
? 27 16
? 27 10
? 27 13
? 27 11
? 27 12
? 31 11
! 31 11
? 45 22
? 45 21
? 45 34
? 45 28
? 45 31
? 45 29
? 45 30
? 4 29
! 4 29
? 24 1
? 24 46
? 24 13
? 24 7
? 24 10
? 24 8
? 39 7
! 39 7
? 2 25
? 2 24
? 2 13
? 2 7
? 2 10
? 2 12
? 2 11
? 6 11
! 6 11
? 35 12
? 35 11
? 35 24
? 35 18
? 35 21...

result:

ok ok (1000 test cases)

Test #17:

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

input:

1000
1000000000
499999999
499999998
250000000
374999999
312500000
343750000
359375000
367187499
363281250
365234375
366210937
365722657
365966797
365844727
365783693
365814211
365829470
365837098
365833285
365835192
365836145
365835668
365835431
365835550
365835609
365835580
365835595
365835602
3658...

output:

? 506211782 6211782
? 506211782 6211781
? 506211782 756211782
? 506211782 881211782
? 506211782 818711782
? 506211782 849961782
? 506211782 865586782
? 506211782 873399282
? 506211782 869493032
? 506211782 871446157
? 506211782 872422720
? 506211782 871934439
? 506211782 872178580
? 506211782 872056...

result:

ok ok (1000 test cases)

Test #18:

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

input:

1000
1000000000
499999969
499999968
250000000
375000000
437499969
406249969
390624969
382812469
378906250
380859375
381835907
381347626
381103485
380981415
380920380
380889893
380905121
380897492
380893708
380895585
380894631
380894185
380894424
380894543
380894572
380894573
380894569
380894565
3808...

output:

? 22356311 522356311
? 22356311 522356310
? 22356311 272356311
? 22356311 397356311
? 22356311 459856311
? 22356311 428606311
? 22356311 412981311
? 22356311 405168811
? 22356311 401262561
? 22356311 403215686
? 22356311 404192249
? 22356311 403703968
? 22356311 403459827
? 22356311 403337757
? 2235...

result:

ok ok (1000 test cases)

Test #19:

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

input:

1000
1000000000
241140799
241140800
250000000
125000001
178640799
147390799
131765799
123953299
121093751
122000174
121023612
120605469
120779472
120657402
120596367
120574951
120581108
120573479
120571136
120571572
120570618
120570659
120570420
120570499
120570440
120570410
120570405
120570403
1205...

output:

? 616503697 116503697
? 616503697 116503696
? 616503697 366503697
? 616503697 241503697
? 616503697 179003697
? 616503697 210253697
? 616503697 225878697
? 616503697 233691197
? 616503697 237597447
? 616503697 235644322
? 616503697 236620884
? 616503697 237109165
? 616503697 236865024
? 616503697 23...

result:

ok ok (1000 test cases)

Test #20:

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

input:

1000
1000000000
9471246
9471247
250000000
125000072
62500072
31250072
15625072
7812572
5564996
5859447
4882884
5076715
4832575
4760813
4771540
4741023
4745554
4737924
4737209
4736016
4736256
4735779
4735777
4735660
4735717
4735687
4735672
4735665
4735661
4735659
4735660
1
1
1000000000
52398665
52398...

output:

? 380021688 880021688
? 380021688 880021687
? 380021688 130021688
? 380021688 5021688
? 380021688 942521688
? 380021688 911271688
? 380021688 895646688
? 380021688 887834188
? 380021688 883927938
? 380021688 885881063
? 380021688 884904500
? 380021688 884416219
? 380021688 884660359
? 380021688 8847...

result:

ok ok (1000 test cases)

Test #21:

score: 0
Accepted
time: 71ms
memory: 3456kb

input:

1000
1000000000
288090905
288090904
39444927
163090905
100590905
69340905
53715905
45903405
41997155
40044030
39067468
38956645
38823328
38834574
38773539
38792811
38777552
38769923
38769724
38768016
38768770
38768293
38768054
38767935
38767957
38767927
38767920
38767920
38767916
38767918
38767917
1...

output:

? 707450940 207450940
? 707450940 207450939
? 707450940 957450940
? 707450940 82450940
? 707450940 19950940
? 707450940 988700940
? 707450940 973075940
? 707450940 965263440
? 707450940 961357190
? 707450940 959404065
? 707450940 958427503
? 707450940 957939222
? 707450940 958183363
? 707450940 9580...

result:

ok ok (1000 test cases)

Test #22:

score: -100
Wrong Answer
time: 50ms
memory: 3584kb

input:

1000
999999999
499999998
499999997
249999999
374999998
312499998
281249999
296874998
289062499
292968749
294921874
295898436
295410155
295166014
295043945
295104980
295135497
295120239
295127869
295131683
295129777
295130731
295131208
295131446
295131565
295131624
295131595
295131610
295131617
29513...

output:

? 923486929 423486929
? 923486929 423486928
? 923486929 173486929
? 923486929 298486929
? 923486929 235986929
? 923486929 204736929
? 923486929 220361929
? 923486929 212549429
? 923486929 216455679
? 923486929 218408804
? 923486929 219385367
? 923486929 218897086
? 923486929 218652945
? 923486929 21...

result:

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