QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#882707#9734. Identify ChordrbtreeWA 68ms3712kbC++266.1kb2025-02-05 10:50:422025-02-05 10:50:43

Judging History

This is the latest submission verdict.

  • [2025-02-05 10:50:43]
  • Judged
  • Verdict: WA
  • Time: 68ms
  • Memory: 3712kb
  • [2025-02-05 10:50:42]
  • 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;
      if (n >= 100000) {
         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;
      fd.insert(x);
      fd.insert(y);
      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: 3456kb

input:

2
6
2
2
1
1
4
2
1
1

output:

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

result:

ok ok (2 test cases)

Test #2:

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

input:

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

output:

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

result:

ok ok (1000 test cases)

Test #3:

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

input:

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

output:

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

result:

ok ok (1000 test cases)

Test #4:

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

input:

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

output:

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

result:

ok ok (1000 test cases)

Test #5:

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

input:

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

output:

? 22 7
? 22 6
? 22 29
? 22 4
? 22 2
? 22 3
! 22 3
? 25 11
? 25 10
? 25 4
? 25 8
? 25 6
? 25 7
? 26 8
! 24 8
? 27 12
? 27 11
? 27 20
? 27 16
? 27 18
? 27 17
? 2 17
! 2 17
? 22 7
? 24 9
? 24 8
? 24 16
? 24 12
? 24 14
? 24 13
? 2 13
! 2 13
? 9 23
? 9 22
? 9 2
? 9 26
? 9 24
? 14 23
! 14 23
? 3 17
? 3 16...

result:

ok ok (1000 test cases)

Test #6:

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

input:

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

output:

? 32 16
? 32 15
? 32 8
? 32 12
? 32 10
? 32 9
? 5 9
! 5 9
? 22 7
? 22 6
? 22 29
? 22 25
? 22 27
? 22 28
? 26 28
! 26 28
? 29 13
? 29 12
? 29 5
? 29 9
? 29 7
? 29 8
? 32 9
! 26 9
? 24 8
? 24 7
? 24 31
? 24 4
? 24 2
? 24 3
? 2 4
! 15 4
? 20 4
? 20 3
? 20 28
? 20 32
? 20 2
? 21 3
! 21 3
? 18 2
? 18 1
?...

result:

ok ok (1000 test cases)

Test #7:

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

input:

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

output:

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

result:

ok ok (1000 test cases)

Test #8:

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

input:

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

output:

? 14 32
? 14 31
? 14 23
? 14 18
? 14 21
? 14 20
? 14 19
? 18 20
! 18 20
? 30 12
? 30 11
? 30 21
? 30 16
? 30 18
? 30 19
? 30 20
? 35 19
! 35 19
? 14 32
? 14 31
? 14 5
? 14 36
? 14 2
? 14 3
? 14 4
? 18 4
! 10 4
? 15 33
? 15 32
? 15 6
? 15 1
? 15 3
? 15 4
? 17 3
! 17 3
? 30 12
? 30 11
? 30 3
? 30 8
? ...

result:

ok ok (1000 test cases)

Test #9:

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

input:

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

output:

? 26 7
? 26 6
? 26 16
? 26 11
? 26 13
? 26 14
? 26 15
? 27 14
! 27 14
? 5 23
? 5 22
? 5 32
? 5 27
? 5 25
? 5 26
? 18 26
! 28 26
? 9 28
? 9 27
? 9 18
? 9 13
? 9 16
? 9 17
? 11 18
! 7 18
? 10 28
? 10 27
? 10 19
? 10 24
? 10 22
? 10 21
? 10 20
? 13 21
! 13 21
? 14 32
? 14 31
? 14 23
? 14 28
? 14 26
? 1...

result:

ok ok (1000 test cases)

Test #10:

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

input:

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

output:

? 21 1
? 21 39
? 21 11
? 21 16
? 21 13
? 21 14
? 25 13
! 25 13
? 5 24
? 5 23
? 5 14
? 5 19
? 5 22
? 5 21
? 5 20
? 15 21
! 33 21
? 30 11
? 30 10
? 30 21
? 30 16
? 30 13
? 30 14
? 30 15
? 34 15
! 26 15
? 26 6
? 19 38
? 19 37
? 19 9
? 19 4
? 19 1
? 19 2
? 19 3
? 28 2
! 10 2
? 9 28
? 9 27
? 9 18
? 9 23
...

result:

ok ok (1000 test cases)

Test #11:

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

input:

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

output:

? 22 2
? 22 1
? 22 12
? 22 7
? 22 9
? 22 8
? 26 7
! 26 7
? 1 21
? 1 20
? 1 31
? 1 26
? 1 28
? 1 27
? 12 27
! 12 27
? 13 33
? 13 32
? 13 3
? 13 38
? 13 35
? 13 34
? 23 33
! 3 33
? 12 32
? 12 31
? 12 2
? 12 37
? 12 39
? 12 40
? 12 1
? 14 1
! 14 1
? 19 39
? 19 38
? 19 29
? 19 24
? 19 27
? 19 28
? 23 28...

result:

ok ok (1000 test cases)

Test #12:

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

input:

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

output:

? 33 12
? 24 3
? 24 2
? 24 14
? 24 8
? 24 5
? 24 6
? 24 7
? 31 6
! 17 6
? 12 32
? 12 31
? 12 1
? 12 37
? 12 34
? 12 33
? 27 33
! 38 33
? 20 40
? 20 39
? 20 9
? 20 4
? 20 1
? 20 41
? 24 40
! 16 40
? 23 2
? 23 1
? 23 33
? 23 38
? 23 36
? 23 35
? 30 36
! 16 36
? 7 27
? 7 26
? 7 17
? 7 22
? 7 25
? 7 24
...

result:

ok ok (1000 test cases)

Test #13:

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

input:

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

output:

? 26 4
? 26 3
? 26 36
? 26 42
? 26 2
? 31 3
! 21 3
? 40 19
? 40 18
? 40 30
? 40 24
? 40 21
? 40 20
? 16 20
! 16 20
? 40 18
? 40 17
? 40 29
? 40 23
? 40 20
? 40 21
? 40 22
? 5 21
! 5 21
? 17 38
? 17 37
? 17 27
? 17 33
? 17 36
? 17 35
? 17 34
? 20 35
! 14 35
? 28 6
? 28 5
? 28 38
? 28 1
? 28 4
? 40 5
...

result:

ok ok (1000 test cases)

Test #14:

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

input:

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

output:

? 38 16
? 38 15
? 38 5
? 38 11
? 38 8
? 38 7
? 38 6
? 41 6
! 41 6
? 4 26
? 4 25
? 4 37
? 4 31
? 4 28
? 4 29
? 4 30
? 5 29
! 5 29
? 24 2
? 24 1
? 24 34
? 24 40
? 24 37
? 24 36
? 24 35
! 24 36
? 18 39
? 18 38
? 18 28
? 18 23
? 18 26
? 18 27
! 18 28
? 32 10
? 32 9
? 32 43
? 32 5
? 32 2
? 32 1
? 40 2
! ...

result:

ok ok (1000 test cases)

Test #15:

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

input:

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

output:

? 41 18
? 41 17
? 41 7
? 41 1
? 41 4
? 41 6
? 41 5
? 45 5
! 45 5
? 12 34
? 12 33
? 12 45
? 12 39
? 12 42
? 12 43
! 12 42
? 20 42
? 20 41
? 20 8
? 20 2
? 20 5
? 20 6
? 22 5
! 18 5
? 39 16
? 39 15
? 39 5
? 39 11
? 39 8
? 39 7
? 39 6
? 1 6
! 32 6
? 23 45
? 23 44
? 23 11
? 23 5
? 23 2
? 23 3
? 32 2
! 14...

result:

ok ok (1000 test cases)

Test #16:

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

input:

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

output:

? 1 24
? 1 23
? 1 36
? 1 30
? 1 33
? 1 31
? 1 32
? 11 31
! 11 31
? 45 22
? 45 21
? 45 34
? 45 28
? 45 31
? 45 29
? 45 30
? 4 29
! 4 29
? 6 29
? 6 28
? 6 41
? 6 35
? 6 38
? 6 39
? 6 40
? 7 39
! 7 39
? 46 23
? 46 22
? 46 11
? 46 5
? 46 8
? 46 10
? 6 11
! 6 11
? 18 41
? 18 40
? 18 7
? 18 1
? 18 4
? 18 ...

result:

ok ok (1000 test cases)

Test #17:

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

input:

1000
1000000000
499999999
499999999
250000000
375000000
437500000
468750000
484375000
492187499
488281249
486328125
487304688
487792969
488037110
488159179
488098144
488067628
488082886
488075258
488079073
488080980
488081933
488081456
488081218
488081100
488081159
488081130
488081145
488081153
4880...

output:

? 360128535 860128535
? 360128535 860128534
? 360128535 110128535
? 360128535 985128535
? 360128535 922628535
? 360128535 891378535
? 360128535 875753535
? 360128535 867941035
? 360128535 871847285
? 360128535 873800410
? 360128535 872823847
? 360128535 872335566
? 360128535 872091425
? 360128535 87...

result:

ok ok (1000 test cases)

Test #18:

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

input:

1000
1000000000
499999969
499999970
249999969
125000000
187499969
156250000
171874969
164062500
167968719
166015625
166992188
167480469
167724610
167846680
167907715
167938233
167953492
167961090
167957307
167959183
167958261
167958738
167958945
167958857
167958886
167958856
167958855
167958849
1679...

output:

? 571209752 71209752
? 571209752 71209751
? 571209752 321209752
? 571209752 446209752
? 571209752 383709752
? 571209752 414959752
? 571209752 399334752
? 571209752 407147252
? 571209752 403241002
? 571209752 405194127
? 571209752 404217564
? 571209752 403729283
? 571209752 403485142
? 571209752 4033...

result:

ok ok (1000 test cases)

Test #19:

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

input:

1000
1000000000
170999007
170999006
250000000
125000001
108499007
93750001
92874007
85937501
88967757
87014632
86038070
85549789
85693360
85571289
85510254
85519272
85504013
85502624
85500199
85500716
85499762
85499723
85499523
85499604
85499545
85499515
85499508
85499508
85499504
85499506
85499505
...

output:

? 822573599 322573599
? 822573599 322573598
? 822573599 72573599
? 822573599 197573599
? 822573599 260073599
? 822573599 228823599
? 822573599 244448599
? 822573599 236636099
? 822573599 240542349
? 822573599 238589224
? 822573599 237612662
? 822573599 237124381
? 822573599 236880240
? 822573599 237...

result:

ok ok (1000 test cases)

Test #20:

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

input:

1000
1000000000
232533336
232533335
250000000
125000072
170033336
138783336
123158336
117187572
119252086
117298961
116322399
116699290
116455149
116333079
116272044
116291882
116276623
116268994
116268229
116267087
116267275
116266798
116266849
116266730
116266738
116266708
116266715
116266708
1162...

output:

? 1023978 501023978
? 1023978 501023977
? 1023978 251023978
? 1023978 376023978
? 1023978 438523978
? 1023978 407273978
? 1023978 391648978
? 1023978 383836478
? 1023978 387742728
? 1023978 385789603
? 1023978 384813041
? 1023978 384324760
? 1023978 384568901
? 1023978 384690971
? 1023978 384752006
...

result:

ok ok (1000 test cases)

Test #21:

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

input:

1000
1000000000
445507171
445507172
250000000
375000000
383007171
381840905
367382171
374028405
370122155
368169030
367192467
366893890
366948326
366826256
366832855
366802338
366810997
366803367
366799552
366800431
366799478
366799075
366799240
366799121
366799061
366799045
366799046
366799039
3667...

output:

? 379419818 879419818
? 379419818 879419817
? 379419818 129419818
? 379419818 4419818
? 379419818 941919818
? 379419818 973169818
? 379419818 957544818
? 379419818 965357318
? 379419818 961451068
? 379419818 959497943
? 379419818 958521380
? 379419818 958033099
? 379419818 958277239
? 379419818 9581...

result:

ok ok (1000 test cases)

Test #22:

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

input:

1000
999999999
499999999
499999999
499999998
499999997
249999999
374999998
312499999
343749998
328124998
320312499
324218748
322265623
321289061
320800781
321044922
321166992
321228027
321258545
321273804
321281432
321277619
321279526
321280479
321280002
321279765
321279883
321279824
321279794
32127...

output:

? 257212699 757212698
? 267278662 767278661
? 897338755 397338755
? 897338755 397338754
? 897338755 147338755
? 897338755 272338755
? 897338755 209838755
? 897338755 241088755
? 897338755 225463755
? 897338755 217651255
? 897338755 221557505
? 897338755 219604380
? 897338755 218627818
? 897338755 21...

result:

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