QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#882698#9734. Identify ChordrbtreeWA 58ms3712kbC++266.0kb2025-02-05 10:48:452025-02-05 10:48:46

Judging History

This is the latest submission verdict.

  • [2025-02-05 10:48:46]
  • Judged
  • Verdict: WA
  • Time: 58ms
  • Memory: 3712kb
  • [2025-02-05 10:48:45]
  • 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;
      bool flag = false;
      for (auto i : fd) {
         if (abs(x - i) <= 5000000 || abs(y - i) <= 5000000) {
            if (lib::rng(0, 1000) != 0) {
               flag = true;
               break;
            }
         }
      }
      if (flag) continue;
      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: 1ms
memory: 3584kb

input:

2
6
2
2
1
1
4
1
1

output:

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

result:

ok ok (2 test cases)

Test #2:

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

input:

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

output:

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

result:

ok ok (1000 test cases)

Test #3:

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

input:

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

output:

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

result:

ok ok (1000 test cases)

Test #4:

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

input:

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

output:

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

result:

ok ok (1000 test cases)

Test #5:

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

input:

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

output:

? 10 24
? 10 23
? 10 17
? 10 21
? 10 22
? 17 22
! 3 22
? 22 8
? 22 7
? 22 15
? 22 11
? 22 9
? 24 8
! 24 8
? 27 12
? 27 11
? 27 20
? 27 16
? 27 18
? 27 17
? 2 17
! 2 17
? 8 22
? 23 8
? 24 9
? 24 8
? 24 16
? 24 12
? 24 14
? 24 13
? 2 13
! 2 13
? 24 10
? 24 9
? 24 17
? 24 13
? 24 15
? 24 14
? 25 14
! 2...

result:

ok ok (1000 test cases)

Test #6:

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

input:

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

output:

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

result:

ok ok (1000 test cases)

Test #7:

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

input:

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

output:

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

result:

ok ok (1000 test cases)

Test #8:

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

input:

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

output:

? 22 4
? 22 3
? 22 13
? 22 18
? 22 20
? 22 19
? 24 18
! 20 18
? 31 13
? 31 12
? 31 22
? 31 17
? 31 19
? 31 20
? 35 19
! 35 19
? 12 30
? 12 29
? 12 3
? 12 8
? 12 5
? 12 4
? 14 4
! 10 4
? 21 3
? 21 2
? 21 12
? 21 7
? 21 5
? 21 4
? 25 3
! 17 3
? 24 6
? 24 5
? 24 15
? 24 10
? 24 8
? 24 7
? 32 6
! 32 6
?...

result:

ok ok (1000 test cases)

Test #9:

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

input:

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

output:

? 29 10
? 29 9
? 29 19
? 29 14
? 29 16
? 29 15
? 31 14
! 27 14
? 22 4
? 22 3
? 22 31
? 22 26
? 22 29
? 22 28
? 22 27
? 26 28
! 26 28
? 16 35
? 16 34
? 16 7
? 16 12
? 16 9
? 16 8
? 18 7
! 18 7
? 27 8
? 27 7
? 27 17
? 27 12
? 27 14
? 27 13
? 33 13
! 21 13
? 22 3
? 22 2
? 22 31
? 22 26
? 22 29
? 22 28
...

result:

ok ok (1000 test cases)

Test #10:

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

input:

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

output:

? 2 21
? 2 20
? 2 31
? 2 26
? 2 23
? 2 24
? 2 25
? 13 25
! 13 25
? 23 4
? 23 3
? 23 32
? 23 37
? 23 35
? 23 34
? 23 33
? 25 33
! 21 33
? 32 13
? 32 12
? 32 23
? 32 18
? 32 15
? 32 16
? 38 15
! 26 15
? 37 17
? 37 16
? 37 7
? 37 12
? 37 10
? 37 9
? 2 10
! 2 10
? 25 6
? 25 5
? 25 16
? 25 21
? 25 23
? 2...

result:

ok ok (1000 test cases)

Test #11:

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

input:

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

output:

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

result:

ok ok (1000 test cases)

Test #12:

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

input:

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

output:

? 41 20
? 41 19
? 41 9
? 41 15
? 41 18
? 41 17
? 41 16
? 6 17
! 6 17
? 7 27
? 7 26
? 7 37
? 7 32
? 7 34
? 7 33
? 17 33
! 38 33
? 34 13
? 34 12
? 34 23
? 34 18
? 34 15
? 34 16
? 34 17
? 40 16
! 40 16
? 8 28
? 8 27
? 8 38
? 8 33
? 8 35
? 8 36
? 8 37
? 16 36
! 16 36
? 29 8
? 29 7
? 29 18
? 29 13
? 29 1...

result:

ok ok (1000 test cases)

Test #13:

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

input:

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

output:

? 40 18
? 40 17
? 40 29
? 40 23
? 40 20
? 40 21
? 40 22
? 3 21
! 3 21
? 10 31
? 10 30
? 10 20
? 10 15
? 10 18
? 10 19
? 16 20
! 16 20
? 14 35
? 16 37
? 16 36
? 16 5
? 16 10
? 16 7
? 16 6
? 21 5
! 21 5
? 11 32
? 11 31
? 11 43
? 11 37
? 11 34
? 11 35
? 11 36
? 14 35
! 14 35
? 26 4
? 26 3
? 26 15
? 26 ...

result:

ok ok (1000 test cases)

Test #14:

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

input:

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

output:

? 24 2
? 42 20
? 42 19
? 42 9
? 42 3
? 42 6
? 42 5
? 43 6
! 41 6
? 39 17
? 15 37
? 15 36
? 15 26
? 15 32
? 15 29
? 15 28
? 25 29
! 5 29
? 22 43
? 22 42
? 22 32
? 22 38
? 22 35
? 22 37
? 22 36
? 24 36
! 24 36
? 20 41
? 20 40
? 20 30
? 20 25
? 20 28
? 20 27
? 22 28
! 18 28
? 12 34
? 12 33
? 12 1
? 12 ...

result:

ok ok (1000 test cases)

Test #15:

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

input:

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

output:

? 15 37
? 15 36
? 15 3
? 15 42
? 15 45
? 15 1
? 25 45
! 5 45
? 28 5
? 15 37
? 15 36
? 15 3
? 15 42
? 15 45
? 15 43
? 18 42
! 12 42
? 6 28
? 6 27
? 6 17
? 6 23
? 6 20
? 6 19
? 6 18
? 7 18
! 5 18
? 10 32
? 10 31
? 10 43
? 10 37
? 10 34
? 10 33
? 14 32
! 6 32
? 33 10
? 33 9
? 33 21
? 33 15
? 33 12
? 33...

result:

ok ok (1000 test cases)

Test #16:

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

input:

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

output:

? 39 16
? 39 15
? 39 4
? 39 10
? 39 13
? 39 12
? 39 11
? 1 11
! 31 11
? 19 42
? 19 41
? 19 8
? 19 2
? 19 5
? 19 3
? 19 4
? 29 4
! 29 4
? 12 35
? 12 34
? 12 1
? 12 41
? 12 38
? 12 39
? 12 40
? 17 39
! 7 39
? 39 16
? 39 15
? 39 4
? 39 10
? 39 13
? 39 12
? 39 11
? 6 11
! 6 11
? 34 11
? 8 31
? 8 30
? 8 ...

result:

ok ok (1000 test cases)

Test #17:

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

input:

1000
1000000000
499999999
499999999
249999999
125000000
187499999
156250000
171875000
179687500
183593749
181640625
182617187
182128907
182373047
182250978
182312012
182281495
182266236
182258608
182262423
182264330
182265284
182265760
182265522
182265403
182265344
182265373
182265359
182265366
1822...

output:

? 54312743 554312743
? 54312743 554312742
? 54312743 804312743
? 54312743 929312743
? 54312743 866812743
? 54312743 898062743
? 54312743 882437743
? 54312743 874625243
? 54312743 870718993
? 54312743 872672118
? 54312743 871695555
? 54312743 872183836
? 54312743 871939695
? 54312743 872061765
? 5431...

result:

ok ok (1000 test cases)

Test #18:

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

input:

1000
1000000000
499999969
499999968
250000000
375000000
437500000
468749969
453125000
460937469
457031219
455078094
454101532
453613251
453369110
453247040
453186036
453216523
453201264
453193635
453189820
453187913
453186990
453187467
453187675
453187587
453187616
453187617
453187621
453187613
4531...

output:

? 950063263 450063263
? 950063263 450063262
? 950063263 200063263
? 950063263 325063263
? 950063263 387563263
? 950063263 418813263
? 950063263 403188263
? 950063263 411000763
? 950063263 407094513
? 950063263 405141388
? 950063263 404164826
? 950063263 403676545
? 950063263 403432404
? 950063263 40...

result:

ok ok (1000 test cases)

Test #19:

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

input:

1000
1000000000
400905845
400905846
250000000
275905845
213405845
218750001
203125001
205593345
201687095
201171876
200710533
200683594
200466393
200561523
200500488
200469970
200454711
200458764
200454950
200453043
200453757
200453280
200453041
200452924
200452981
200452951
200452936
200452929
2004...

output:

? 36621174 536621174
? 36621174 536621173
? 36621174 786621174
? 36621174 661621174
? 36621174 724121174
? 36621174 755371174
? 36621174 739746174
? 36621174 731933674
? 36621174 735839924
? 36621174 737793049
? 36621174 736816486
? 36621174 737304767
? 36621174 737060626
? 36621174 737182696
? 3662...

result:

ok ok (1000 test cases)

Test #20:

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

input:

1000
1000000000
254825470
254825471
250000000
129825470
187500072
156250072
140625072
132812572
128906322
127872345
127929759
127441478
127628205
127506135
127445100
127414582
127426219
127418589
127414774
127412867
127413629
127413152
127412914
127412795
127412807
127412777
127412780
127412773
1274...

output:

? 257344576 757344576
? 257344576 757344575
? 257344576 7344576
? 257344576 882344576
? 257344576 944844576
? 257344576 913594576
? 257344576 897969576
? 257344576 890157076
? 257344576 886250826
? 257344576 884297701
? 257344576 885274263
? 257344576 884785982
? 257344576 884541841
? 257344576 8846...

result:

ok ok (1000 test cases)

Test #21:

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

input:

1000
1000000000
288090905
288090906
38090905
125000000
81831431
50581431
34956431
30278405
31050181
29097056
29301843
28813562
28852915
28730844
28752527
28722010
28715585
28714381
28711770
28712474
28711520
28711293
28711282
28711173
28711223
28711193
28711178
28711171
28711169
28711169
28711168
57...

output:

? 986839118 486839118
? 986839118 486839117
? 986839118 736839118
? 986839118 861839118
? 986839118 799339118
? 986839118 768089118
? 986839118 752464118
? 986839118 744651618
? 986839118 748557868
? 986839118 746604743
? 986839118 745628180
? 986839118 746116461
? 986839118 746360602
? 986839118 74...

result:

ok ok (1000 test cases)

Test #22:

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

input:

1000
999999999
499999998
499999997
249999999
374999998
312499999
343749998
328124998
320312499
324218748
322265623
321289061
320800781
321044921
320922851
320861817
320892334
320877075
320869447
320873262
320875168
320874215
320873738
320873501
320873619
320873560
320873530
320873516
320873524
32087...

output:

? 897745018 397745018
? 897745018 397745017
? 897745018 147745018
? 897745018 272745018
? 897745018 210245018
? 897745018 241495018
? 897745018 225870018
? 897745018 218057518
? 897745018 221963768
? 897745018 220010643
? 897745018 219034081
? 897745018 218545800
? 897745018 218789941
? 897745018 21...

result:

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