QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#882737#9734. Identify ChordrbtreeWA 78ms3712kbC++265.9kb2025-02-05 11:02:432025-02-05 11:02:44

Judging History

This is the latest submission verdict.

  • [2025-02-05 11:02:44]
  • Judged
  • Verdict: WA
  • Time: 78ms
  • Memory: 3712kb
  • [2025-02-05 11:02:43]
  • 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;
      if (n % 2 == 0) { x = (x + 1) % n; y = (y + 1) % n; }
      else if ((y - x + n) % n == n / 2) y = y % n + 1;
      else x = x % n + 1;
   }
   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[]) {
}

// :\ */

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

2
6
2
2
2
1
1
4
1
1

output:

? 1 4
? 1 3
? 1 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
4
4
3
5
1
19
4
5
5
2
3
1
1
17
3
2
4
3
3
1
15
7
6
5
2
2
1
1
14
5
6
1
2
1
15
3
4
4
3
2
1
1
17
7
6
4
5
4
2
1
20
6
7
5
6
5
7
1
13
3
4
2
2
1
1
18
9
7
8
4
5
6
1
1
13
6
5
4
2
2
2
1
14
6
6
3
4
4
1
1
17
7
6
4
6
2
1
12
3
2
3
3
3
1
10
3
2
2
1
1
14
6
6
3
5
6
1
1
19
7
6
2
2
1
1
19
4
5
5
2
3
3
1
12
6
...

output:

? 10 2
? 10 1
? 10 6
? 10 4
? 10 5
? 12 5
! 8 5
? 11 1
? 11 19
? 11 6
? 11 3
? 11 4
? 12 3
! 12 3
? 4 12
? 4 11
? 4 8
? 4 10
? 5 11
! 3 11
? 6 13
? 15 7
? 15 6
? 15 3
? 15 2
? 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
? 17 8
? 17 7
? 17 4
? 17 6
? 17 5
? 3...

result:

ok ok (1000 test cases)

Test #3:

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

input:

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

output:

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

result:

ok ok (1000 test cases)

Test #4:

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

input:

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

output:

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

result:

ok ok (1000 test cases)

Test #5:

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

input:

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

output:

? 26 11
? 26 10
? 26 4
? 26 29
? 26 2
? 26 3
? 1 3
! 22 3
? 17 3
? 17 2
? 17 10
? 17 6
? 17 8
? 17 9
? 24 8
! 24 8
? 11 26
? 11 25
? 11 4
? 11 30
? 11 2
? 11 3
? 17 2
! 17 2
? 18 3
? 18 2
? 18 25
? 18 29
? 18 1
? 23 2
! 13 2
? 14 28
? 14 27
? 14 21
? 14 25
? 14 23
? 14 22
! 14 23
? 10 24
? 27 12
? 2...

result:

ok ok (1000 test cases)

Test #6:

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

input:

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

output:

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

result:

ok ok (1000 test cases)

Test #7:

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

input:

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

output:

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

result:

ok ok (1000 test cases)

Test #8:

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

input:

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

output:

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

result:

ok ok (1000 test cases)

Test #9:

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

input:

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

output:

? 26 7
? 26 6
? 26 16
? 26 11
? 26 13
? 26 14
? 26 15
? 27 14
! 27 14
? 24 6
? 24 5
? 24 33
? 24 28
? 24 26
? 24 27
? 26 28
! 26 28
? 10 29
? 10 28
? 10 19
? 10 14
? 10 17
? 10 18
? 13 18
! 7 18
? 19 37
? 19 36
? 19 9
? 19 14
? 19 11
? 19 12
? 19 13
? 21 13
! 21 13
? 21 2
? 21 1
? 21 30
? 21 25
? 21...

result:

ok ok (1000 test cases)

Test #10:

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

input:

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

output:

? 16 35
? 16 34
? 16 25
? 16 20
? 16 23
? 16 24
? 19 25
! 13 25
? 29 10
? 29 9
? 29 20
? 29 25
? 29 22
? 29 21
? 33 21
! 33 21
? 2 21
? 1 20
? 25 6
? 25 5
? 25 16
? 25 11
? 25 13
? 25 14
? 25 15
? 26 15
! 26 15
? 27 7
? 27 6
? 27 17
? 27 12
? 27 9
? 27 10
? 27 11
? 2 10
! 2 10
? 35 16
? 35 15
? 35 2...

result:

ok ok (1000 test cases)

Test #11:

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

input:

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

output:

? 4 24
? 4 23
? 4 34
? 4 29
? 4 26
? 4 27
? 7 26
! 7 26
? 38 18
? 38 17
? 38 8
? 38 13
? 38 11
? 38 12
? 9 12
! 27 12
? 27 7
? 27 6
? 27 37
? 27 2
? 27 5
? 27 4
? 27 3
? 33 3
! 33 3
? 14 34
? 14 33
? 14 4
? 14 39
? 14 1
? 14 2
! 14 1
? 19 39
? 19 38
? 19 29
? 19 24
? 19 27
? 19 28
? 23 28
! 23 28
? ...

result:

ok ok (1000 test cases)

Test #12:

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

input:

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

output:

? 15 36
? 15 35
? 15 5
? 15 10
? 15 7
? 15 6
? 17 6
! 17 6
? 39 18
? 39 17
? 39 28
? 39 33
? 39 36
? 39 34
? 40 33
! 38 33
? 25 4
? 25 3
? 25 35
? 25 40
? 25 38
? 25 39
? 34 40
! 16 40
? 33 12
? 33 11
? 33 22
? 33 17
? 33 14
? 33 15
? 33 16
? 36 16
! 36 16
? 36 15
? 36 14
? 36 5
? 36 10
? 36 8
? 36 ...

result:

ok ok (1000 test cases)

Test #13:

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

input:

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

output:

? 34 12
? 20 41
? 20 40
? 20 9
? 20 3
? 20 6
? 20 4
? 21 3
! 21 3
? 41 20
? 41 19
? 41 31
? 41 25
? 41 22
? 41 21
? 16 20
! 16 20
? 1 22
? 1 21
? 1 11
? 1 17
? 1 20
? 5 21
! 5 21
? 27 5
? 27 4
? 27 16
? 27 10
? 27 13
? 27 14
? 27 15
? 35 14
! 35 14
? 36 14
? 36 13
? 36 3
? 36 9
? 36 6
? 36 5
? 36 4
...

result:

ok ok (1000 test cases)

Test #14:

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

input:

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

output:

? 31 9
? 31 8
? 31 42
? 31 4
? 31 7
? 31 6
? 31 5
? 41 6
! 41 6
? 11 33
? 11 32
? 11 22
? 11 28
? 11 31
? 11 30
? 11 29
? 17 29
! 5 29
? 19 40
? 19 39
? 19 29
? 19 35
? 19 38
? 19 37
? 19 36
? 24 36
! 24 36
? 5 26
? 5 25
? 5 37
? 5 31
? 5 28
? 5 29
? 18 28
! 18 28
? 42 20
? 42 19
? 42 9
? 42 3
? 42 ...

result:

ok ok (1000 test cases)

Test #15:

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

input:

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

output:

? 38 15
? 38 14
? 38 4
? 38 10
? 38 7
? 38 6
? 38 5
? 45 5
! 45 5
? 27 4
? 6 28
? 6 27
? 6 39
? 6 45
? 6 42
? 6 43
? 12 42
! 12 42
? 22 44
? 22 43
? 22 10
? 22 4
? 22 7
? 22 5
? 22 6
? 26 5
! 18 5
? 44 21
? 44 20
? 44 32
? 44 38
? 44 35
? 44 33
? 6 32
! 6 32
? 4 26
? 4 25
? 4 15
? 4 9
? 4 12
? 4 14
...

result:

ok ok (1000 test cases)

Test #16:

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

input:

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

output:

? 19 42
? 19 41
? 19 30
? 19 36
? 19 33
? 19 32
? 19 31
? 27 31
! 11 31
? 31 8
? 31 7
? 31 42
? 31 2
? 31 5
? 31 4
? 31 3
? 33 4
! 29 4
? 33 10
? 33 9
? 33 44
? 33 4
? 33 7
? 33 6
? 39 7
! 39 7
? 31 8
? 24 1
? 24 46
? 24 13
? 24 7
? 24 4
? 24 5
? 24 6
? 37 6
! 11 6
? 39 16
? 39 15
? 39 28
? 39 22
? ...

result:

ok ok (1000 test cases)

Test #17:

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

input:

1000
1000000000
499999999
499999999
249999999
125000000
187499999
156250000
171875000
179687500
183593749
181640625
182617187
182128907
182373047
182250977
182189942
182159424
182144166
182151795
182147980
182146074
182147027
182146550
182146312
182146194
182146254
182146283
182146268
182146261
1821...

output:

? 54193637 554193637
? 54193637 554193636
? 54193637 804193637
? 54193637 929193637
? 54193637 866693637
? 54193637 897943637
? 54193637 882318637
? 54193637 874506137
? 54193637 870599887
? 54193637 872553012
? 54193637 871576449
? 54193637 872064730
? 54193637 871820589
? 54193637 871942659
? 5419...

result:

ok ok (1000 test cases)

Test #18:

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

input:

1000
1000000000
499999969
499999968
249999969
124999969
62499969
31249969
15625000
23437500
27343719
25390594
24414032
23925782
24169923
24291993
24352997
24322480
24307221
24299623
24303438
24305314
24304361
24303884
24303677
24303796
24303825
24303819
24303810
24303811
24303807
24303809
24303808
1...

output:

? 378947067 878947067
? 378947067 878947066
? 378947067 628947067
? 378947067 503947067
? 378947067 441447067
? 378947067 410197067
? 378947067 394572067
? 378947067 402384567
? 378947067 406290817
? 378947067 404337692
? 378947067 403361130
? 378947067 402872849
? 378947067 403116990
? 378947067 40...

result:

ok ok (1000 test cases)

Test #19:

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

input:

1000
1000000000
139891013
139891014
250000000
125000001
77391013
93750001
78125001
70312501
73484763
71531638
70555076
70066795
70068360
69946289
70005760
69975243
69959984
69952355
69948540
69946633
69945679
69945812
69945573
69945560
69945513
69945531
69945516
69945509
69945509
69945507
69945508
1...

output:

? 167128590 667128590
? 167128590 667128589
? 167128590 917128590
? 167128590 792128590
? 167128590 729628590
? 167128590 760878590
? 167128590 745253590
? 167128590 737441090
? 167128590 733534840
? 167128590 735487965
? 167128590 736464527
? 167128590 736952808
? 167128590 737196949
? 167128590 73...

result:

ok ok (1000 test cases)

Test #20:

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

input:

1000
1000000000
267585232
267585233
249999930
142585232
187499930
156249930
140624930
134772732
136718680
134765555
133796170
134277273
134033132
133911062
133850027
133819509
133804250
133796621
133792806
133794263
133793310
133792833
133792595
133792686
133792626
133792596
133792581
133792588
1337...

output:

? 750964695 250964695
? 750964695 250964694
? 750964695 500964695
? 750964695 375964695
? 750964695 438464695
? 750964695 407214695
? 750964695 391589695
? 750964695 383777195
? 750964695 387683445
? 750964695 385730320
? 750964695 384753757
? 750964695 385242038
? 750964695 384997897
? 750964695 38...

result:

ok ok (1000 test cases)

Test #21:

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

input:

1000
1000000000
288586889
288586890
38586889
86909097
24409097
7336889
8784097
971597
3430639
1477514
500952
483315
256812
361244
300209
269691
254432
249183
250617
248710
248230
248233
247994
248111
248052
248022
248007
248000
247996
247994
247993
1
1
1000000000
431953545
431953544
250000000
375000...

output:

? 957879959 457879959
? 957879959 457879958
? 957879959 707879959
? 957879959 832879959
? 957879959 770379959
? 957879959 739129959
? 957879959 754754959
? 957879959 746942459
? 957879959 743036209
? 957879959 744989334
? 957879959 745965896
? 957879959 746454177
? 957879959 746210036
? 957879959 74...

result:

ok ok (1000 test cases)

Test #22:

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

input:

1000
999999999
499999999
499999999
499999999
499999998
499999997
249999999
374999998
312499999
343749998
328124999
335937499
339843749
341796873
340820311
340332031
340576171
340454101
340393066
340362549
340377807
340370179
340373994
340375901
340376855
340377331
340377094
340377212
340377153
34037...

output:

? 587870107 87870107
? 232639239 732639238
? 402599637 902599636
? 878241443 378241443
? 878241443 378241442
? 878241443 128241443
? 878241443 253241443
? 878241443 190741443
? 878241443 221991443
? 878241443 206366443
? 878241443 214178943
? 878241443 218085193
? 878241443 220038318
? 878241443 219...

result:

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