QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#882717#9734. Identify ChordrbtreeWA 72ms3712kbC++266.1kb2025-02-05 10:54:542025-02-05 10:54:54

Judging History

This is the latest submission verdict.

  • [2025-02-05 10:54:54]
  • Judged
  • Verdict: WA
  • Time: 72ms
  • Memory: 3712kb
  • [2025-02-05 10:54: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;
      if (n >= 1000000) {
         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[]) {
}

// :\ */

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

2
6
3
2
2
1
1
4
1
1

output:

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

output:

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

result:

ok ok (1000 test cases)

Test #3:

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

input:

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

output:

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

result:

ok ok (1000 test cases)

Test #4:

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

input:

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

output:

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

result:

ok ok (1000 test cases)

Test #5:

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

input:

1000
29
5
4
6
2
4
3
1
1
28
11
10
7
8
8
7
4
1
30
5
6
7
5
3
4
1
1
29
7
6
7
8
7
8
1
28
6
7
7
7
5
6
9
1
29
9
10
8
6
6
5
1
1
29
14
9
10
8
6
8
7
11
1
28
11
10
7
11
11
1
1
30
8
9
7
8
6
7
1
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
7
10
8
7
1
1
29
11
10
4
3
4
3
1
1
29
14
7
8
4
4
2
3
3
1
2...

output:

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

result:

ok ok (1000 test cases)

Test #6:

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

input:

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

output:

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

result:

ok ok (1000 test cases)

Test #7:

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

input:

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

output:

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

result:

ok ok (1000 test cases)

Test #8:

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

input:

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

output:

? 24 6
? 24 5
? 24 15
? 24 20
? 24 17
? 24 18
? 24 19
? 28 18
! 20 18
? 5 23
? 5 22
? 5 14
? 5 19
? 5 17
? 5 18
? 11 19
! 35 19
? 3 21
? 3 20
? 3 12
? 3 7
? 3 10
? 3 9
? 4 10
! 4 10
? 14 32
? 14 31
? 14 5
? 14 36
? 14 2
? 14 3
? 14 4
? 17 3
! 17 3
? 10 28
? 10 27
? 10 1
? 10 32
? 10 34
? 10 33
? 14 ...

result:

ok ok (1000 test cases)

Test #9:

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

input:

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

output:

? 23 4
? 23 3
? 23 13
? 23 18
? 23 15
? 23 14
? 27 14
! 27 14
? 19 1
? 19 36
? 19 28
? 19 23
? 19 26
? 19 27
? 26 28
! 26 28
? 35 16
? 35 15
? 35 26
? 35 21
? 35 18
? 35 19
? 7 18
! 7 18
? 9 27
? 9 26
? 9 18
? 9 23
? 9 21
? 9 20
? 13 21
! 13 21
? 3 21
? 3 20
? 3 12
? 3 17
? 3 19
? 3 18
? 16 19
! 27 ...

result:

ok ok (1000 test cases)

Test #10:

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

input:

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

output:

? 31 11
? 31 10
? 31 21
? 31 16
? 31 13
? 31 14
? 37 13
! 25 13
? 31 12
? 31 11
? 31 22
? 31 17
? 31 19
? 31 20
? 31 21
? 33 21
! 33 21
? 28 9
? 28 8
? 28 19
? 28 14
? 28 16
? 28 15
? 30 15
! 26 15
? 23 3
? 23 2
? 23 32
? 23 37
? 23 1
? 36 2
! 10 2
? 1 20
? 1 19
? 1 30
? 1 25
? 1 22
? 1 21
? 14 21
!...

result:

ok ok (1000 test cases)

Test #11:

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

input:

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

output:

? 21 1
? 21 40
? 21 11
? 21 6
? 21 8
? 21 7
? 26 7
! 26 7
? 21 1
? 21 40
? 21 11
? 21 16
? 21 13
? 21 12
? 27 12
! 27 12
? 4 24
? 4 23
? 4 34
? 4 29
? 4 31
? 4 32
? 4 33
? 5 33
! 3 33
? 30 10
? 30 9
? 30 20
? 30 15
? 30 12
? 30 13
? 30 14
? 1 14
! 1 14
? 8 28
? 8 27
? 8 38
? 8 33
? 8 30
? 8 29
? 23 ...

result:

ok ok (1000 test cases)

Test #12:

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

input:

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

output:

? 22 1
? 22 42
? 22 12
? 22 6
? 22 9
? 22 7
? 27 6
! 17 6
? 25 4
? 25 3
? 25 35
? 25 40
? 25 38
? 25 37
? 33 38
! 33 38
? 29 8
? 34 13
? 34 12
? 34 23
? 34 18
? 34 15
? 34 16
? 34 17
? 40 16
! 40 16
? 14 34
? 14 33
? 14 3
? 14 39
? 14 36
? 14 37
? 16 36
! 16 36
? 12 32
? 12 31
? 12 22
? 12 27
? 12 2...

result:

ok ok (1000 test cases)

Test #13:

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

input:

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

output:

? 34 12
? 35 13
? 35 12
? 35 24
? 35 18
? 35 21
? 35 22
? 3 21
! 3 21
? 15 36
? 15 35
? 15 25
? 15 20
? 15 17
? 15 19
? 16 20
! 16 20
? 31 9
? 31 8
? 31 41
? 31 4
? 31 7
? 31 6
? 31 5
? 41 5
! 21 5
? 30 8
? 30 7
? 30 19
? 30 13
? 30 16
? 30 14
? 30 15
? 35 14
! 35 14
? 11 32
? 11 31
? 11 43
? 11 37
...

result:

ok ok (1000 test cases)

Test #14:

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

input:

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

output:

? 27 5
? 27 4
? 27 16
? 27 10
? 27 7
? 27 6
? 41 6
! 41 6
? 32 10
? 32 9
? 32 43
? 32 5
? 32 2
? 32 4
? 35 5
! 29 5
? 18 39
? 18 38
? 18 28
? 18 34
? 18 37
? 18 36
? 18 35
? 24 36
! 24 36
? 34 12
? 34 11
? 34 23
? 34 17
? 34 20
? 34 18
? 34 19
? 40 18
! 28 18
? 27 5
? 27 4
? 27 38
? 27 44
? 27 3
? 2...

result:

ok ok (1000 test cases)

Test #15:

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

input:

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

output:

? 28 5
? 28 4
? 28 16
? 28 10
? 28 7
? 28 6
? 45 5
! 45 5
? 2 24
? 2 23
? 2 13
? 2 7
? 2 10
? 2 12
? 2 11
? 7 12
! 42 12
? 9 31
? 9 30
? 9 20
? 9 14
? 9 17
? 9 19
? 9 18
? 13 18
! 5 18
? 7 29
? 7 28
? 7 40
? 7 34
? 7 31
? 7 32
? 7 33
? 8 32
! 6 32
? 12 34
? 12 33
? 12 45
? 12 6
? 12 3
? 12 1
? 12 2
...

result:

ok ok (1000 test cases)

Test #16:

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

input:

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

output:

? 19 42
? 19 41
? 19 30
? 19 36
? 19 33
? 19 32
? 19 31
? 27 31
! 11 31
? 1 24
? 1 23
? 1 36
? 1 30
? 1 27
? 1 28
? 1 29
? 4 29
! 4 29
? 33 10
? 33 9
? 33 44
? 33 4
? 33 7
? 33 6
? 39 7
! 39 7
? 45 22
? 45 21
? 45 10
? 45 16
? 45 13
? 45 12
? 45 11
? 6 11
! 6 11
? 23 46
? 23 45
? 23 12
? 23 6
? 23 3...

result:

ok ok (1000 test cases)

Test #17:

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

input:

1000
1000000000
499999999
499999998
250000000
375000000
437499999
406250000
421875000
429687500
433593750
435546874
434570312
434082032
434326172
434204103
434265138
434295656
434310914
434303286
434307101
434309007
434308055
434308532
434308770
434308889
434308948
434308918
434308903
434308897
4343...

output:

? 437738480 937738480
? 437738480 937738479
? 437738480 687738480
? 437738480 812738480
? 437738480 875238480
? 437738480 843988480
? 437738480 859613480
? 437738480 867425980
? 437738480 871332230
? 437738480 873285355
? 437738480 872308793
? 437738480 871820512
? 437738480 872064653
? 437738480 87...

result:

ok ok (1000 test cases)

Test #18:

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

input:

1000
1000000000
499999969
499999970
249999969
125000000
187500000
218750000
234375000
242187500
246093719
244140625
245117188
245605438
245361329
245483368
245422333
245391816
245376557
245368959
245372743
245370836
245369882
245369436
245369660
245369763
245369704
245369674
245369659
245369652
2453...

output:

? 648620556 148620556
? 648620556 148620555
? 648620556 398620556
? 648620556 523620556
? 648620556 461120556
? 648620556 429870556
? 648620556 414245556
? 648620556 406433056
? 648620556 402526806
? 648620556 404479931
? 648620556 403503368
? 648620556 403015087
? 648620556 403259227
? 648620556 40...

result:

ok ok (1000 test cases)

Test #19:

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

input:

1000
1000000000
312132195
312132194
250000000
187132195
187500001
156250001
171507195
163694695
159788445
157835320
156858758
156370477
156126336
156127930
156066895
156095819
156080560
156072931
156069116
156067209
156066255
156066418
156066179
156066136
156066119
156066107
156066104
156066100
1560...

output:

? 893140193 393140193
? 893140193 393140192
? 893140193 143140193
? 893140193 268140193
? 893140193 205640193
? 893140193 236890193
? 893140193 252515193
? 893140193 244702693
? 893140193 240796443
? 893140193 238843318
? 893140193 237866756
? 893140193 237378475
? 893140193 237134334
? 893140193 23...

result:

ok ok (1000 test cases)

Test #20:

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

input:

1000
1000000000
172206432
172206433
250000000
125000072
109706432
93750072
94081432
86268932
89843822
87890697
86914134
86425853
86181712
86146862
86120677
86116345
86105418
86108716
86104901
86103510
86103948
86103471
86103271
86103352
86103293
86103263
86103256
86103256
86103252
86103254
86103253
...

output:

? 298654095 798654095
? 298654095 798654094
? 298654095 48654095
? 298654095 923654095
? 298654095 861154095
? 298654095 892404095
? 298654095 876779095
? 298654095 884591595
? 298654095 888497845
? 298654095 886544720
? 298654095 885568157
? 298654095 885079876
? 298654095 884835735
? 298654095 884...

result:

ok ok (1000 test cases)

Test #21:

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

input:

1000
1000000000
288090905
288090904
245491621
163090905
182991621
151741621
147465905
143929121
143559655
141975996
142583093
142094812
141850671
141853925
141792890
141820154
141804895
141797266
141793451
141791544
141791936
141791459
141791306
141791339
141791279
141791277
141791264
141791270
1417...

output:

? 604427593 104427593
? 604427593 104427592
? 604427593 854427593
? 604427593 979427593
? 604427593 916927593
? 604427593 948177593
? 604427593 963802593
? 604427593 955990093
? 604427593 959896343
? 604427593 957943218
? 604427593 958919781
? 604427593 958431500
? 604427593 958187359
? 604427593 95...

result:

ok ok (1000 test cases)

Test #22:

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

input:

1000
999999999
499999999
499999998
499999997
249999999
374999998
312499998
281249998
265624998
257812499
261718748
259765623
258789062
259277343
259521484
259643554
259704589
259735107
259750366
259757995
259761810
259763716
259762763
259762286
259762048
259761930
259761989
259761959
259761944
25976...

output:

? 517425173 17425173
? 958856612 458856612
? 958856612 458856611
? 958856612 208856612
? 958856612 333856612
? 958856612 271356612
? 958856612 240106612
? 958856612 224481612
? 958856612 216669112
? 958856612 220575362
? 958856612 218622237
? 958856612 217645675
? 958856612 218133956
? 958856612 218...

result:

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