QOJ.ac

QOJ

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

Judging History

This is the latest submission verdict.

  • [2025-02-05 10:46:57]
  • Judged
  • Verdict: WA
  • Time: 69ms
  • Memory: 3712kb
  • [2025-02-05 10:46:57]
  • 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) <= 10000 || abs(y - i) <= 10000) {
            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: 3584kb

input:

2
6
3
2
2
1
1
4
2
1
1

output:

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

result:

ok ok (2 test cases)

Test #2:

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

input:

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

output:

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

result:

ok ok (1000 test cases)

Test #3:

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

input:

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

output:

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

result:

ok ok (1000 test cases)

Test #4:

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

input:

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

output:

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

result:

ok ok (1000 test cases)

Test #5:

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

input:

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

output:

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

result:

ok ok (1000 test cases)

Test #6:

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

input:

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

output:

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

result:

ok ok (1000 test cases)

Test #7:

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

input:

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

output:

? 19 2
? 19 1
? 19 11
? 19 6
? 19 4
? 19 5
? 31 5
! 31 5
? 9 25
? 9 24
? 9 17
? 9 13
? 9 15
? 9 14
? 12 15
! 6 15
? 17 33
? 17 32
? 17 25
? 17 29
? 17 31
? 17 30
? 24 31
! 24 31
? 9 26
? 9 25
? 9 1
? 9 30
? 9 32
? 9 33
? 11 32
! 11 32
? 15 32
? 30 13
? 30 12
? 30 4
? 30 34
? 30 2
? 30 1
? 33 2
! 27 ...

result:

ok ok (1000 test cases)

Test #8:

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

input:

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

output:

? 20 2
? 20 1
? 20 11
? 20 16
? 20 18
! 20 18
? 19 1
? 19 36
? 19 28
? 19 33
? 19 35
? 19 34
! 19 35
? 13 31
? 13 30
? 13 4
? 13 9
? 13 6
? 13 5
? 16 4
! 10 4
? 24 6
? 24 5
? 24 33
? 24 2
? 24 4
? 24 3
? 31 3
! 17 3
? 7 25
? 7 24
? 7 34
? 7 29
? 7 31
? 7 32
? 7 33
? 8 32
! 6 32
? 17 35
? 17 34
? 17 ...

result:

ok ok (1000 test cases)

Test #9:

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

input:

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

output:

? 20 1
? 3 21
? 35 16
? 35 15
? 35 7
? 35 12
? 35 14
? 35 13
? 6 14
! 27 14
? 6 24
? 6 23
? 6 33
? 6 28
? 6 26
? 6 27
? 20 26
! 28 26
? 32 13
? 31 12
? 21 2
? 21 1
? 21 12
? 21 7
? 21 9
? 21 8
? 24 7
! 18 7
? 22 3
? 22 2
? 22 12
? 22 17
? 22 14
? 22 13
? 23 13
! 21 13
? 27 8
? 27 7
? 27 17
? 27 22
?...

result:

ok ok (1000 test cases)

Test #10:

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

input:

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

output:

? 31 11
? 31 10
? 31 21
? 31 16
? 31 13
? 31 14
? 37 13
! 25 13
? 11 30
? 11 29
? 11 2
? 11 35
? 11 32
? 11 33
? 11 34
? 21 33
! 21 33
? 27 8
? 27 7
? 27 18
? 27 13
? 27 15
? 27 16
? 28 15
! 26 15
? 7 26
? 30 10
? 30 9
? 30 20
? 30 15
? 30 12
? 30 11
? 2 10
! 2 10
? 32 13
? 32 12
? 32 23
? 32 18
? 3...

result:

ok ok (1000 test cases)

Test #11:

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

input:

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

output:

? 12 32
? 12 31
? 12 22
? 12 27
? 12 25
? 12 26
? 17 26
! 7 26
? 22 2
? 22 1
? 22 12
? 22 17
? 22 14
? 22 13
? 27 12
! 27 12
? 25 5
? 25 4
? 25 35
? 25 40
? 25 3
? 25 2
? 33 3
! 33 3
? 8 28
? 20 40
? 20 39
? 20 10
? 20 5
? 20 2
? 20 1
? 26 1
! 14 1
? 34 14
? 34 13
? 34 24
? 34 19
? 34 21
? 34 22
? 3...

result:

ok ok (1000 test cases)

Test #12:

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

input:

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

output:

? 19 40
? 19 39
? 19 9
? 19 3
? 19 6
? 19 7
? 21 6
! 17 6
? 16 36
? 40 19
? 40 18
? 40 29
? 40 34
? 40 31
? 40 32
? 40 33
? 1 33
! 38 33
? 28 7
? 6 26
? 6 25
? 6 16
? 6 11
? 6 14
? 6 15
? 13 16
! 40 16
? 32 11
? 32 10
? 32 21
? 32 16
? 32 18
? 32 17
? 36 16
! 36 16
? 11 31
? 11 30
? 11 21
? 11 26
? ...

result:

ok ok (1000 test cases)

Test #13:

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

input:

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

output:

? 24 2
? 24 1
? 24 13
? 24 7
? 24 4
? 24 3
? 27 3
! 21 3
? 28 7
? 28 6
? 28 18
? 28 12
? 28 15
? 28 16
? 28 17
? 36 16
! 20 16
? 27 5
? 27 4
? 27 16
? 27 10
? 27 7
? 27 6
? 33 5
! 21 5
? 25 3
? 33 11
? 33 10
? 33 22
? 33 16
? 33 13
? 33 14
? 33 15
? 35 14
! 35 14
? 39 17
? 39 16
? 39 6
? 39 1
? 39 4...

result:

ok ok (1000 test cases)

Test #14:

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

input:

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

output:

? 11 33
? 11 32
? 11 44
? 11 38
? 11 41
? 11 42
? 16 41
! 6 41
? 32 10
? 32 9
? 32 43
? 32 5
? 32 2
? 32 4
? 35 5
! 29 5
? 23 1
? 23 43
? 23 33
? 23 39
? 23 36
? 23 35
? 24 36
! 24 36
? 32 10
? 32 9
? 32 21
? 32 15
? 32 18
? 32 19
? 36 18
! 28 18
? 16 38
? 16 37
? 16 5
? 16 43
? 16 40
? 16 41
? 30 4...

result:

ok ok (1000 test cases)

Test #15:

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

input:

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

output:

? 41 18
? 41 17
? 41 7
? 41 1
? 41 4
? 41 6
? 41 5
? 45 5
! 45 5
? 33 10
? 33 9
? 33 21
? 33 15
? 33 12
? 33 13
? 42 12
! 42 12
? 16 38
? 16 37
? 16 4
? 16 10
? 16 7
? 16 5
? 16 6
? 18 5
! 18 5
? 19 41
? 6 28
? 6 27
? 6 39
? 6 33
? 6 30
? 6 31
? 6 32
! 6 32
? 31 8
? 19 41
? 19 40
? 19 7
? 19 1
? 19 ...

result:

ok ok (1000 test cases)

Test #16:

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

input:

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

output:

? 4 27
? 4 26
? 4 39
? 4 33
? 4 30
? 4 31
? 4 32
? 11 31
! 11 31
? 16 39
? 46 23
? 46 22
? 46 35
? 46 29
? 46 32
? 46 30
? 4 29
! 4 29
? 38 15
? 38 14
? 38 3
? 38 9
? 38 6
? 38 8
? 38 7
? 39 7
! 39 7
? 9 32
? 20 43
? 20 42
? 20 9
? 20 3
? 20 6
? 20 7
? 29 6
! 11 6
? 9 32
? 9 31
? 9 20
? 9 14
? 9 17
...

result:

ok ok (1000 test cases)

Test #17:

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

input:

1000
1000000000
499999999
499999998
250000000
374999999
312499999
281249999
265625000
273437499
269531250
271484375
272460938
272949219
273193359
273071289
273010254
272979736
272964477
272956848
272953034
272954941
272953987
272953511
272953750
272953868
272953809
272953779
272953764
272953758
2729...

output:

? 599093620 99093620
? 599093620 99093619
? 599093620 849093620
? 599093620 974093620
? 599093620 911593620
? 599093620 880343620
? 599093620 864718620
? 599093620 872531120
? 599093620 868624870
? 599093620 870577995
? 599093620 871554558
? 599093620 872042839
? 599093620 872286980
? 599093620 8721...

result:

ok ok (1000 test cases)

Test #18:

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

input:

1000
1000000000
499999969
499999968
249999969
124999969
62500000
93750000
109374969
101562500
105468750
107421875
108398407
107910126
107665985
107543915
107482911
107513429
107528688
107536317
107540101
107538194
107537271
107537717
107537510
107537628
107537658
107537628
107537613
107537620
107537...

output:

? 295713261 795713261
? 295713261 795713260
? 295713261 545713261
? 295713261 420713261
? 295713261 358213261
? 295713261 389463261
? 295713261 405088261
? 295713261 397275761
? 295713261 401182011
? 295713261 403135136
? 295713261 404111699
? 295713261 403623418
? 295713261 403379277
? 295713261 40...

result:

ok ok (1000 test cases)

Test #19:

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

input:

1000
1000000000
7244653
7244654
250000000
125000001
62500001
31250001
15625001
7812501
3906251
5291528
4314966
3826685
3662110
3704615
3643580
3631592
3628321
3623962
3624507
3622600
3623008
3622531
3622362
3622411
3622351
3622333
3622336
3622328
3622330
3622328
3622327
1
1
1000000000
375591257
3755...

output:

? 233451770 733451770
? 233451770 733451769
? 233451770 983451770
? 233451770 858451770
? 233451770 795951770
? 233451770 764701770
? 233451770 749076770
? 233451770 741264270
? 233451770 737358020
? 233451770 735404895
? 233451770 736381457
? 233451770 736869738
? 233451770 737113879
? 233451770 73...

result:

ok ok (1000 test cases)

Test #20:

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

input:

1000
1000000000
95398786
95398787
249999930
124999930
62499930
64148786
48523786
54687430
50781180
48828055
47851492
48035505
47791365
47729421
47730330
47699813
47714162
47706532
47702717
47700810
47699856
47699379
47699575
47699456
47699397
47699367
47699364
47699360
47699360
47699358
47699359
1
1...

output:

? 837057918 337057918
? 837057918 337057917
? 837057918 587057918
? 837057918 462057918
? 837057918 399557918
? 837057918 368307918
? 837057918 383932918
? 837057918 391745418
? 837057918 387839168
? 837057918 385886043
? 837057918 384909480
? 837057918 384421199
? 837057918 384665339
? 837057918 38...

result:

ok ok (1000 test cases)

Test #21:

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

input:

1000
1000000000
288090905
288090906
250000000
260811891
225590905
229561891
213936891
217778405
213872155
211983766
212895593
212407312
212163171
212041101
211980066
211953248
211964807
211957178
211953363
211951456
211952294
211951817
211951578
211951459
211951399
211951427
211951412
211951405
2119...

output:

? 170079348 670079348
? 170079348 670079347
? 170079348 920079348
? 170079348 795079348
? 170079348 732579348
? 170079348 763829348
? 170079348 748204348
? 170079348 740391848
? 170079348 744298098
? 170079348 746251223
? 170079348 745274660
? 170079348 745762941
? 170079348 746007082
? 170079348 74...

result:

ok ok (1000 test cases)

Test #22:

score: -100
Wrong Answer
time: 30ms
memory: 3712kb

input:

1000
999999999
499999999
499999998
499999997
249999999
374999999
437499998
406249999
421874998
414062498
410156248
408203124
409179686
408691406
408935547
409057616
408996581
408966065
408981323
408973694
408969879
408967972
408967018
408966541
408966304
408966423
408966483
408966513
408966528
40896...

output:

? 625370927 125370927
? 809652018 309652018
? 809652018 309652017
? 809652018 59652018
? 809652018 184652018
? 809652018 247152018
? 809652018 215902018
? 809652018 231527018
? 809652018 223714518
? 809652018 219808268
? 809652018 217855143
? 809652018 218831706
? 809652018 218343425
? 809652018 218...

result:

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