QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#882729#9734. Identify ChordrbtreeWA 71ms3712kbC++265.8kb2025-02-05 11:01:152025-02-05 11:01:16

Judging History

This is the latest submission verdict.

  • [2025-02-05 11:01:16]
  • Judged
  • Verdict: WA
  • Time: 71ms
  • Memory: 3712kb
  • [2025-02-05 11:01:15]
  • 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;
   set<int> fd;
   while (true) {
      x = lib::rng(0, n - 1);
      y = (x + n / 2) % n;
      d = ask(x, y);
      if (d != n / 2) break;
      x = (x + n / 5) % n;
      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: 3456kb

input:

2
6
2
1
1
4
1
1

output:

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

result:

ok ok (2 test cases)

Test #2:

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

input:

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

output:

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

result:

ok ok (1000 test cases)

Test #3:

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

input:

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

output:

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

result:

ok ok (1000 test cases)

Test #4:

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

input:

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

output:

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

result:

ok ok (1000 test cases)

Test #5:

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

input:

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

output:

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

result:

ok ok (1000 test cases)

Test #6:

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

input:

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

output:

? 29 13
? 29 12
? 29 5
? 29 9
? 29 7
? 29 8
? 5 9
! 5 9
? 12 27
? 18 3
? 18 2
? 18 25
? 18 29
? 18 27
? 18 28
? 26 28
! 26 28
? 21 5
? 21 4
? 21 13
? 21 9
? 21 11
? 21 10
? 26 9
! 26 9
? 16 31
? 16 30
? 16 8
? 16 4
? 16 6
? 16 5
? 17 4
! 15 4
? 6 22
? 6 21
? 6 14
? 6 18
? 6 20
? 9 21
! 3 21
? 14 30
...

result:

ok ok (1000 test cases)

Test #7:

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

input:

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

output:

? 11 28
? 11 27
? 11 3
? 11 32
? 11 30
? 11 31
? 17 31
! 5 31
? 15 31
? 15 30
? 15 6
? 15 10
? 15 8
? 15 7
! 15 6
? 28 11
? 1 17
? 1 16
? 1 25
? 1 21
? 1 23
? 1 24
? 4 24
! 31 24
? 22 5
? 28 11
? 28 10
? 28 20
? 28 15
? 28 13
? 28 12
? 32 11
! 32 11
? 33 16
? 33 15
? 33 25
? 33 29
? 33 27
? 33 28
? ...

result:

ok ok (1000 test cases)

Test #8:

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

input:

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

output:

? 4 22
? 4 21
? 4 13
? 4 18
? 4 20
? 4 19
? 18 20
! 18 20
? 26 8
? 26 7
? 26 35
? 26 30
? 26 33
? 26 34
? 33 35
! 19 35
? 26 8
? 26 7
? 26 17
? 26 12
? 26 10
? 26 11
? 4 10
! 4 10
? 20 2
? 20 1
? 20 11
? 20 6
? 20 4
? 20 3
? 23 3
! 17 3
? 8 26
? 8 25
? 8 35
? 8 30
? 8 32
? 8 33
? 10 32
! 6 32
? 11 2...

result:

ok ok (1000 test cases)

Test #9:

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

input:

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

output:

? 12 30
? 12 29
? 12 21
? 12 26
? 12 28
? 12 27
? 14 27
! 14 27
? 15 33
? 15 32
? 15 24
? 15 29
? 15 27
? 15 28
? 26 28
! 26 28
? 33 14
? 33 13
? 33 24
? 33 19
? 33 16
? 33 17
? 33 18
? 7 18
! 7 18
? 1 19
? 1 18
? 1 28
? 1 23
? 1 21
? 1 22
? 13 21
! 13 21
? 36 17
? 36 16
? 36 26
? 36 21
? 36 19
? 36...

result:

ok ok (1000 test cases)

Test #10:

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

input:

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

output:

? 37 17
? 37 16
? 37 7
? 37 12
? 37 15
? 37 14
? 37 13
? 10 13
! 25 13
? 27 8
? 34 15
? 34 14
? 34 25
? 34 20
? 34 22
? 34 21
? 35 21
! 33 21
? 17 36
? 17 35
? 17 26
? 17 21
? 17 24
? 17 25
? 19 26
! 15 26
? 18 37
? 18 36
? 18 8
? 18 3
? 18 39
? 18 1
? 18 2
? 26 2
! 10 2
? 10 29
? 10 28
? 10 19
? 10...

result:

ok ok (1000 test cases)

Test #11:

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

input:

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

output:

? 33 13
? 33 12
? 33 3
? 33 8
? 33 6
? 33 7
? 40 7
! 26 7
? 2 22
? 2 21
? 2 32
? 2 27
? 2 29
? 2 28
? 12 27
! 12 27
? 9 29
? 9 28
? 9 39
? 9 34
? 9 31
? 9 32
? 9 33
? 15 33
! 3 33
? 9 29
? 9 28
? 9 39
? 9 4
? 9 1
? 9 2
? 14 1
! 14 1
? 34 14
? 34 13
? 34 24
? 34 19
? 34 21
? 34 22
? 34 23
? 40 23
! 2...

result:

ok ok (1000 test cases)

Test #12:

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

input:

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

output:

? 6 27
? 6 26
? 6 16
? 6 22
? 6 19
? 6 18
? 6 17
! 6 17
? 6 26
? 6 25
? 6 36
? 6 31
? 6 33
? 6 34
? 15 33
! 38 33
? 26 5
? 26 4
? 26 36
? 26 41
? 26 39
? 26 40
? 36 40
! 16 40
? 31 10
? 31 9
? 31 20
? 31 15
? 31 17
? 31 16
? 36 16
! 36 16
? 24 3
? 24 2
? 24 13
? 24 8
? 24 10
? 24 11
? 25 10
! 23 10
...

result:

ok ok (1000 test cases)

Test #13:

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

input:

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

output:

? 31 9
? 31 8
? 31 41
? 31 4
? 31 1
? 31 3
? 31 2
? 41 3
! 21 3
? 3 24
? 3 23
? 3 13
? 3 19
? 3 22
? 3 21
? 3 20
? 16 20
! 16 20
? 23 1
? 23 43
? 23 12
? 23 6
? 23 3
? 23 4
? 23 5
? 25 5
! 21 5
? 4 25
? 12 33
? 12 32
? 12 1
? 12 38
? 12 35
? 12 36
? 14 35
! 14 35
? 43 21
? 43 20
? 43 10
? 43 5
? 43 ...

result:

ok ok (1000 test cases)

Test #14:

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

input:

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

output:

? 17 39
? 17 38
? 17 6
? 17 44
? 17 41
? 17 42
? 28 41
! 6 41
? 11 33
? 11 32
? 11 22
? 11 28
? 11 31
? 11 30
? 11 29
? 17 29
! 5 29
? 7 28
? 7 27
? 7 17
? 7 23
? 7 26
? 7 25
? 7 24
? 21 24
! 36 24
? 8 29
? 8 28
? 8 18
? 8 24
? 8 27
? 18 28
! 18 28
? 41 19
? 41 18
? 41 8
? 41 2
? 41 43
? 41 1
? 42 2...

result:

ok ok (1000 test cases)

Test #15:

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

input:

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

output:

? 6 28
? 6 27
? 6 39
? 6 45
? 6 3
? 6 1
? 7 45
! 5 45
? 26 3
? 26 2
? 26 37
? 26 43
? 26 40
? 26 42
? 26 41
? 40 42
! 12 42
? 30 7
? 30 6
? 30 41
? 30 2
? 30 5
? 30 4
? 42 5
! 18 5
? 2 24
? 2 23
? 2 35
? 2 29
? 2 32
? 2 33
? 6 32
! 6 32
? 34 11
? 34 10
? 34 22
? 34 16
? 34 13
? 34 14
? 34 15
? 2 14
...

result:

ok ok (1000 test cases)

Test #16:

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

input:

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

output:

? 3 26
? 3 25
? 3 38
? 3 32
? 3 29
? 3 30
? 3 31
? 11 31
! 11 31
? 40 17
? 3 26
? 3 25
? 3 38
? 3 32
? 3 29
? 3 30
? 4 29
! 4 29
? 43 20
? 43 19
? 43 8
? 43 2
? 43 5
? 43 7
? 43 6
? 1 7
! 39 7
? 32 9
? 41 18
? 41 17
? 41 6
? 41 12
? 41 9
? 41 11
? 41 10
? 6 11
! 6 11
? 24 1
? 24 46
? 24 13
? 24 7
? ...

result:

ok ok (1000 test cases)

Test #17:

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

input:

1000
1000000000
499999999
499999998
250000000
375000000
437499999
406250000
421875000
429687500
433593750
435546875
436523437
436035157
436279298
436401367
436340332
436309815
436294556
436286927
436283113
436285020
436284066
436283589
436283351
436283233
436283292
436283263
436283277
436283270
4362...

output:

? 435764117 935764117
? 435764117 935764116
? 435764117 685764117
? 435764117 810764117
? 435764117 873264117
? 435764117 842014117
? 435764117 857639117
? 435764117 865451617
? 435764117 869357867
? 435764117 871310992
? 435764117 872287555
? 435764117 871799274
? 435764117 872043415
? 435764117 87...

result:

ok ok (1000 test cases)

Test #18:

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

input:

1000
1000000000
499999969
499999968
249999969
124999969
62500000
93749969
78124969
70312500
74218719
72265625
73242157
72753876
72509735
72387665
72326661
72357179
72372438
72380067
72383851
72381944
72381021
72381498
72381737
72381825
72381776
72381796
72381781
72381774
72381772
72381772
72381771
1...

output:

? 330869103 830869103
? 330869103 830869102
? 330869103 580869103
? 330869103 455869103
? 330869103 393369103
? 330869103 424619103
? 330869103 408994103
? 330869103 401181603
? 330869103 405087853
? 330869103 403134728
? 330869103 404111291
? 330869103 403623010
? 330869103 403378869
? 330869103 40...

result:

ok ok (1000 test cases)

Test #19:

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

input:

1000
1000000000
335961925
335961924
250000000
210961925
187500001
179711925
171875001
171899425
167993175
169921876
168945313
168457032
168212891
168090821
168029786
167999268
167984009
167985546
167981732
167982101
167981147
167981256
167981018
167981027
167980967
167980989
167980974
167980967
1679...

output:

? 405055058 905055058
? 405055058 905055057
? 405055058 655055058
? 405055058 780055058
? 405055058 717555058
? 405055058 748805058
? 405055058 733180058
? 405055058 740992558
? 405055058 737086308
? 405055058 735133183
? 405055058 736109746
? 405055058 736598027
? 405055058 736842168
? 405055058 73...

result:

ok ok (1000 test cases)

Test #20:

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

input:

1000
1000000000
68878564
68878563
250000000
125000072
62500072
37628564
46875072
39062572
35156322
35675439
34698877
34668040
34454737
34545969
34484934
34454416
34439479
34446786
34442971
34441064
34440110
34439633
34439395
34439360
34439335
34439331
34439320
34439324
34439320
34439318
34439319
688...

output:

? 919196592 419196592
? 919196592 419196591
? 919196592 169196592
? 919196592 294196592
? 919196592 356696592
? 919196592 387946592
? 919196592 372321592
? 919196592 380134092
? 919196592 384040342
? 919196592 385993467
? 919196592 385016905
? 919196592 384528624
? 919196592 384772765
? 919196592 38...

result:

ok ok (1000 test cases)

Test #21:

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

input:

1000
1000000000
364809691
364809690
250000000
375000000
350590905
333559691
334965905
327153405
329653441
327700316
326723754
326665123
326479614
326543052
326482017
326451499
326464356
326456727
326452912
326451005
326450545
326450528
326450306
326450409
326450350
326450320
326450305
326450298
3264...

output:

? 284578248 784578248
? 284578248 784578247
? 284578248 534578248
? 284578248 659578248
? 284578248 722078248
? 284578248 753328248
? 284578248 737703248
? 284578248 745515748
? 284578248 749421998
? 284578248 747468873
? 284578248 746492311
? 284578248 746004030
? 284578248 746248171
? 284578248 74...

result:

ok ok (1000 test cases)

Test #22:

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

input:

1000
999999999
499999999
499999999
499999999
499999998
499999997
249999999
374999999
437499998
406249999
421874998
414062498
410156248
408203123
407226561
406738281
406982421
406860352
406921387
406951904
406936645
406929017
406932831
406930924
406929971
406930448
406930686
406930568
406930628
40693...

output:

? 255945275 755945274
? 455945274 955945273
? 611687919 111687919
? 811687918 311687918
? 811687918 311687917
? 811687918 61687918
? 811687918 186687918
? 811687918 249187918
? 811687918 217937918
? 811687918 233562918
? 811687918 225750418
? 811687918 221844168
? 811687918 219891043
? 811687918 218...

result:

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