QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#882697#9734. Identify ChordrbtreeWA 77ms3712kbC++266.0kb2025-02-05 10:47:542025-02-05 10:47:55

Judging History

This is the latest submission verdict.

  • [2025-02-05 10:47:55]
  • Judged
  • Verdict: WA
  • Time: 77ms
  • Memory: 3712kb
  • [2025-02-05 10:47:54]
  • 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) <= 500000 || abs(y - i) <= 500000) {
            if (lib::rng(0, 500) != 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: 0ms
memory: 3456kb

input:

2
6
2
1
1
4
1
1

output:

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

result:

ok ok (2 test cases)

Test #2:

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

input:

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

output:

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

result:

ok ok (1000 test cases)

Test #3:

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

input:

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

output:

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

result:

ok ok (1000 test cases)

Test #4:

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

input:

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

output:

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

result:

ok ok (1000 test cases)

Test #5:

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

input:

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

output:

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

result:

ok ok (1000 test cases)

Test #6:

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

input:

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

output:

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

result:

ok ok (1000 test cases)

Test #7:

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

input:

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

output:

? 8 25
? 8 24
? 8 34
? 8 29
? 8 31
? 8 32
? 11 31
! 5 31
? 16 32
? 16 31
? 16 7
? 16 3
? 16 5
? 16 6
? 17 6
! 15 6
? 11 27
? 29 12
? 29 11
? 29 20
? 29 24
? 29 26
? 29 25
? 31 24
! 31 24
? 28 11
? 28 10
? 28 20
? 28 15
? 28 13
? 28 12
? 32 11
! 32 11
? 3 20
? 3 19
? 3 29
? 3 24
? 3 26
? 3 27
? 3 28
...

result:

ok ok (1000 test cases)

Test #8:

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

input:

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

output:

? 21 3
? 21 2
? 21 12
? 21 17
? 21 19
? 21 18
? 22 18
! 20 18
? 16 34
? 16 33
? 16 7
? 16 2
? 16 36
? 16 35
? 19 35
! 19 35
? 15 33
? 15 32
? 15 6
? 15 1
? 15 3
? 15 4
? 15 5
? 20 4
! 10 4
? 28 10
? 19 1
? 19 36
? 19 10
? 19 5
? 19 3
? 19 4
? 21 3
! 17 3
? 28 10
? 28 9
? 28 1
? 28 6
? 28 4
? 28 5
? ...

result:

ok ok (1000 test cases)

Test #9:

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

input:

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

output:

? 14 32
? 14 31
? 14 23
? 14 28
? 14 26
? 14 27
! 14 27
? 12 30
? 12 29
? 12 21
? 12 26
? 12 28
? 12 27
? 26 28
! 26 28
? 34 15
? 34 14
? 34 25
? 34 20
? 34 17
? 34 18
? 34 19
? 7 18
! 7 18
? 9 27
? 9 26
? 9 18
? 9 23
? 9 21
? 9 20
? 13 21
! 13 21
? 22 3
? 22 2
? 22 31
? 22 26
? 22 29
? 22 28
? 22 2...

result:

ok ok (1000 test cases)

Test #10:

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

input:

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

output:

? 4 23
? 4 22
? 4 33
? 4 28
? 4 25
? 4 26
? 13 25
! 13 25
? 28 9
? 28 8
? 28 19
? 28 24
? 28 21
? 28 22
? 33 21
! 33 21
? 12 31
? 12 30
? 12 21
? 12 26
? 12 24
? 12 25
? 15 26
! 15 26
? 29 9
? 29 8
? 29 19
? 29 14
? 29 11
? 29 10
? 2 10
! 2 10
? 6 25
? 6 24
? 6 35
? 6 30
? 6 27
? 6 26
? 21 26
! 21 2...

result:

ok ok (1000 test cases)

Test #11:

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

input:

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

output:

? 8 28
? 8 27
? 8 18
? 8 23
? 8 26
? 8 25
? 9 26
! 7 26
? 13 33
? 13 32
? 13 23
? 13 28
? 13 26
? 13 27
? 14 27
! 12 27
? 8 28
? 8 27
? 8 38
? 8 33
? 8 35
? 8 34
? 13 33
! 3 33
? 26 6
? 26 5
? 26 36
? 26 1
? 26 39
? 26 40
? 38 1
! 14 1
? 21 1
? 21 40
? 21 31
? 21 26
? 21 29
? 21 28
? 21 27
? 23 28
!...

result:

ok ok (1000 test cases)

Test #12:

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

input:

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

output:

? 22 1
? 22 42
? 22 12
? 22 6
? 22 9
? 22 7
? 27 6
! 17 6
? 17 37
? 17 36
? 17 6
? 17 1
? 17 39
? 17 38
? 33 38
! 33 38
? 12 32
? 12 31
? 12 1
? 12 37
? 12 39
? 12 40
? 12 41
? 16 40
! 16 40
? 10 30
? 10 29
? 10 40
? 10 35
? 10 37
? 10 36
? 16 36
! 16 36
? 4 24
? 4 23
? 4 14
? 4 19
? 4 22
? 10 23
! ...

result:

ok ok (1000 test cases)

Test #13:

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

input:

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

output:

? 29 7
? 29 6
? 29 39
? 29 2
? 29 5
? 29 4
? 29 3
? 37 3
! 21 3
? 31 10
? 31 9
? 31 21
? 31 15
? 31 18
? 31 16
? 31 17
? 42 16
! 20 16
? 24 2
? 24 1
? 24 13
? 24 7
? 24 4
? 24 5
? 24 6
? 27 5
! 21 5
? 14 35
? 14 34
? 14 3
? 14 40
? 14 37
? 14 36
! 14 35
? 14 35
? 14 34
? 14 3
? 14 40
? 14 43
? 14 41...

result:

ok ok (1000 test cases)

Test #14:

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

input:

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

output:

? 27 5
? 27 4
? 27 16
? 27 10
? 27 7
? 27 6
? 41 6
! 41 6
? 18 40
? 18 39
? 18 7
? 18 1
? 18 4
? 18 5
? 18 6
? 29 5
! 29 5
? 22 43
? 22 42
? 22 32
? 22 38
? 22 35
? 22 37
? 22 36
? 24 36
! 24 36
? 1 22
? 8 29
? 8 28
? 8 18
? 8 24
? 8 27
? 18 28
! 18 28
? 24 2
? 24 1
? 24 13
? 24 7
? 24 4
? 24 3
? 40...

result:

ok ok (1000 test cases)

Test #15:

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

input:

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

output:

? 34 11
? 34 10
? 34 45
? 34 6
? 34 3
? 34 5
? 34 4
? 45 5
! 45 5
? 28 5
? 11 33
? 11 32
? 11 44
? 11 38
? 11 41
? 11 42
? 11 43
? 12 42
! 12 42
? 38 15
? 38 14
? 38 26
? 38 20
? 38 17
? 38 18
? 38 19
? 5 18
! 5 18
? 1 23
? 1 22
? 1 34
? 1 28
? 1 31
? 1 32
? 1 33
? 6 32
! 6 32
? 30 7
? 17 39
? 17 38...

result:

ok ok (1000 test cases)

Test #16:

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

input:

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

output:

? 41 18
? 41 17
? 41 6
? 41 12
? 41 9
? 41 11
? 41 10
? 5 11
! 31 11
? 38 15
? 38 14
? 38 3
? 38 9
? 38 6
? 38 5
? 38 4
? 1 4
! 29 4
? 27 4
? 27 3
? 27 16
? 27 10
? 27 7
? 27 8
? 39 7
! 39 7
? 28 5
? 28 4
? 28 17
? 28 11
? 28 8
? 28 6
? 28 7
? 45 6
! 11 6
? 4 27
? 4 26
? 4 15
? 4 21
? 4 18
? 4 20
? ...

result:

ok ok (1000 test cases)

Test #17:

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

input:

1000
1000000000
499999999
499999999
249999999
125000000
187499999
156249999
140625000
148437499
144531250
146484374
145507812
145019532
145263672
145141602
145080568
145111085
145095826
145088198
145092012
145090105
145089152
145089629
145089868
145089986
145089927
145089898
145089912
145089906
1450...

output:

? 17137292 517137292
? 17137292 517137291
? 17137292 767137292
? 17137292 892137292
? 17137292 829637292
? 17137292 860887292
? 17137292 876512292
? 17137292 868699792
? 17137292 872606042
? 17137292 870652917
? 17137292 871629479
? 17137292 872117760
? 17137292 871873619
? 17137292 871995689
? 1713...

result:

ok ok (1000 test cases)

Test #18:

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

input:

1000
1000000000
499999969
499999970
250000000
374999969
312500000
343749969
328125000
335937500
339843719
337890625
338867188
339355438
339111298
338989228
338928193
338897675
338882416
338874787
338870972
338869096
338870050
338870496
338870258
338870139
338870110
338870109
338870104
338870102
3388...

output:

? 742121003 242121003
? 742121003 242121002
? 742121003 492121003
? 742121003 367121003
? 742121003 429621003
? 742121003 398371003
? 742121003 413996003
? 742121003 406183503
? 742121003 402277253
? 742121003 404230378
? 742121003 403253815
? 742121003 402765534
? 742121003 403009674
? 742121003 40...

result:

ok ok (1000 test cases)

Test #19:

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

input:

1000
1000000000
93811333
93811334
250000000
125000001
62500001
62561333
46936333
54687501
50781251
48828126
47851563
47363282
47119141
46997071
46936036
46905816
46920777
46913147
46909332
46907425
46906471
46905994
46905756
46905697
46905696
46905668
46905681
46905673
46905669
46905667
46905668
1
1...

output:

? 690168430 190168430
? 690168430 190168429
? 690168430 440168430
? 690168430 315168430
? 690168430 252668430
? 690168430 221418430
? 690168430 237043430
? 690168430 244855930
? 690168430 240949680
? 690168430 238996555
? 690168430 238019992
? 690168430 237531711
? 690168430 237287570
? 690168430 23...

result:

ok ok (1000 test cases)

Test #20:

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

input:

1000
1000000000
127724456
127724455
249999930
124999930
65224456
93749930
78124930
70312430
66406180
64453055
64247894
63964773
64003754
63881684
63903737
63873219
63866426
63865589
63862612
63863681
63862727
63862250
63862374
63862255
63862196
63862220
63862205
63862197
63862193
63862195
63862194
1...

output:

? 448619538 948619538
? 448619538 948619537
? 448619538 698619538
? 448619538 823619538
? 448619538 886119538
? 448619538 854869538
? 448619538 870494538
? 448619538 878307038
? 448619538 882213288
? 448619538 884166413
? 448619538 885142976
? 448619538 884654695
? 448619538 884898836
? 448619538 88...

result:

ok ok (1000 test cases)

Test #21:

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

input:

1000
1000000000
288090905
288090904
250000000
164769575
225590905
194340905
178715905
170903405
166997155
165044030
164067468
164281293
164037152
163945398
163976117
163945599
163930340
163937769
163933955
163932048
163931094
163930617
163930379
163930260
163930280
163930250
163930245
163930242
1639...

output:

? 582288616 82288616
? 582288616 82288615
? 582288616 832288616
? 582288616 957288616
? 582288616 19788616
? 582288616 988538616
? 582288616 972913616
? 582288616 965101116
? 582288616 961194866
? 582288616 959241741
? 582288616 958265179
? 582288616 957776898
? 582288616 958021039
? 582288616 95814...

result:

ok ok (1000 test cases)

Test #22:

score: -100
Wrong Answer
time: 14ms
memory: 3456kb

input:

1000
999999999
499999999
499999998
499999997
249999999
374999998
312499998
281249999
296874999
304687499
308593748
306640623
305664062
306152342
305908202
305786132
305725098
305755616
305770875
305778504
305782318
305780412
305781365
305780888
305780650
305780532
305780592
305780622
305780636
30578...

output:

? 601735166 101735166
? 912837923 412837923
? 912837923 412837922
? 912837923 162837923
? 912837923 287837923
? 912837923 225337923
? 912837923 194087923
? 912837923 209712923
? 912837923 217525423
? 912837923 221431673
? 912837923 219478548
? 912837923 218501986
? 912837923 218990267
? 912837923 21...

result:

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