QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#882667#9734. Identify ChordrbtreeAC ✓71ms3712kbC++265.7kb2025-02-05 10:37:002025-02-05 10:37:01

Judging History

This is the latest submission verdict.

  • [2025-02-05 10:37:01]
  • Judged
  • Verdict: AC
  • Time: 71ms
  • Memory: 3712kb
  • [2025-02-05 10:37:00]
  • 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;
   while (true) {
      x = lib::rng(0, n - 1);
      y = (x + n / 2) % n;
      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[]) {
}

// :\ */

这程序好像有点Bug,我给组数据试试?

详细

Test #1:

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

input:

2
6
2
1
1
4
1
1

output:

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

result:

ok ok (2 test cases)

Test #2:

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

input:

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

output:

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

result:

ok ok (1000 test cases)

Test #3:

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

input:

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

output:

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

result:

ok ok (1000 test cases)

Test #4:

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

input:

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

output:

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

result:

ok ok (1000 test cases)

Test #5:

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

input:

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

output:

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

result:

ok ok (1000 test cases)

Test #6:

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

input:

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

output:

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

result:

ok ok (1000 test cases)

Test #7:

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

input:

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

output:

? 12 29
? 12 28
? 12 4
? 12 33
? 12 31
? 12 32
? 19 31
! 5 31
? 26 9
? 26 8
? 26 1
? 26 5
? 26 7
? 26 6
? 4 6
! 15 6
? 26 9
? 26 8
? 26 1
? 26 30
? 26 32
? 26 31
? 28 31
! 24 31
? 14 31
? 14 30
? 14 6
? 14 1
? 14 33
? 14 32
? 17 32
! 11 32
? 14 31
? 18 1
? 18 34
? 18 10
? 18 5
? 18 3
? 18 2
? 27 2
!...

result:

ok ok (1000 test cases)

Test #8:

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

input:

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

output:

? 4 22
? 4 21
? 4 13
? 4 18
? 4 20
? 4 19
? 18 20
! 18 20
? 3 21
? 3 20
? 3 12
? 3 17
? 3 19
? 3 18
? 7 19
! 35 19
? 5 23
? 5 22
? 5 14
? 5 9
? 5 12
? 5 11
? 5 10
? 6 10
! 4 10
? 28 10
? 3 21
? 3 20
? 3 12
? 3 17
? 3 15
? 3 16
! 3 17
? 15 33
? 15 32
? 15 24
? 15 29
? 15 31
? 24 32
! 6 32
? 32 14
? 3...

result:

ok ok (1000 test cases)

Test #9:

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

input:

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

output:

? 10 28
? 10 27
? 10 19
? 10 24
? 10 26
? 14 27
! 14 27
? 12 30
? 12 29
? 12 21
? 12 26
? 12 28
? 12 27
? 26 28
! 26 28
? 4 23
? 4 22
? 4 13
? 4 18
? 4 16
? 4 17
? 7 18
! 7 18
? 14 32
? 14 31
? 14 23
? 14 18
? 14 21
? 14 20
? 15 21
! 13 21
? 29 10
? 29 9
? 29 19
? 29 24
? 29 21
? 29 20
? 31 19
! 27 ...

result:

ok ok (1000 test cases)

Test #10:

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

input:

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

output:

? 25 5
? 25 4
? 25 15
? 25 10
? 25 12
? 25 13
? 25 14
! 25 13
? 2 21
? 2 20
? 2 31
? 2 26
? 2 23
? 2 22
? 9 21
! 33 21
? 33 14
? 33 13
? 33 24
? 33 19
? 33 16
? 33 15
? 2 15
! 26 15
? 22 2
? 22 1
? 22 12
? 22 7
? 22 4
? 22 3
? 34 2
! 10 2
? 15 34
? 15 33
? 15 24
? 15 29
? 15 27
? 15 26
? 15 25
? 21 ...

result:

ok ok (1000 test cases)

Test #11:

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

input:

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

output:

? 6 26
? 6 25
? 6 36
? 6 31
? 6 28
? 6 27
? 7 26
! 7 26
? 36 16
? 36 15
? 36 6
? 36 11
? 36 14
? 36 13
? 36 12
? 5 12
! 27 12
? 27 7
? 27 6
? 27 37
? 27 2
? 27 5
? 27 4
? 27 3
? 33 3
! 33 3
? 39 19
? 39 18
? 39 9
? 39 14
? 39 12
? 39 13
? 1 14
! 1 14
? 25 5
? 8 28
? 8 27
? 8 38
? 8 33
? 8 30
? 8 29
...

result:

ok ok (1000 test cases)

Test #12:

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

input:

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

output:

? 16 37
? 16 36
? 16 6
? 16 11
? 16 8
? 16 7
? 17 6
! 17 6
? 7 27
? 7 26
? 7 37
? 7 32
? 7 34
? 7 33
? 17 33
! 38 33
? 34 13
? 34 12
? 34 23
? 34 18
? 34 15
? 34 16
? 34 17
? 40 16
! 40 16
? 38 17
? 38 16
? 38 7
? 38 12
? 38 15
? 40 16
! 36 16
? 33 12
? 33 11
? 33 2
? 33 7
? 33 10
? 33 9
? 2 10
! 23...

result:

ok ok (1000 test cases)

Test #13:

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

input:

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

output:

? 23 1
? 23 43
? 23 12
? 23 6
? 23 3
? 23 4
? 25 3
! 21 3
? 33 12
? 33 11
? 33 23
? 33 17
? 33 14
? 33 15
? 33 16
? 4 16
! 20 16
? 11 32
? 11 31
? 11 21
? 11 16
? 11 19
? 11 20
? 17 21
! 5 21
? 15 36
? 15 35
? 15 25
? 15 31
? 15 34
? 16 35
! 14 35
? 3 24
? 3 23
? 3 35
? 3 40
? 3 43
? 3 41
? 5 40
! 5...

result:

ok ok (1000 test cases)

Test #14:

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

input:

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

output:

? 31 9
? 31 8
? 31 42
? 31 4
? 31 7
? 31 6
? 31 5
? 41 6
! 41 6
? 25 3
? 25 2
? 25 14
? 25 8
? 25 5
? 25 6
? 29 5
! 29 5
? 22 43
? 22 42
? 22 32
? 22 38
? 22 35
? 22 37
? 22 36
? 24 36
! 24 36
? 5 26
? 5 25
? 5 37
? 5 31
? 5 28
? 5 29
? 18 28
! 18 28
? 13 35
? 13 34
? 13 2
? 13 40
? 13 43
? 13 41
? ...

result:

ok ok (1000 test cases)

Test #15:

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

input:

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

output:

? 13 35
? 13 34
? 13 1
? 13 40
? 13 43
? 13 44
? 13 45
? 21 45
! 5 45
? 7 29
? 7 28
? 7 40
? 7 1
? 7 43
? 7 41
? 7 42
? 12 42
! 12 42
? 34 11
? 37 14
? 37 13
? 37 25
? 37 19
? 37 16
? 37 17
? 37 18
? 5 18
! 5 18
? 38 15
? 38 14
? 38 4
? 38 10
? 38 7
? 38 6
? 38 5
? 44 6
! 32 6
? 5 27
? 5 26
? 5 16
?...

result:

ok ok (1000 test cases)

Test #16:

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

input:

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

output:

? 16 39
? 16 38
? 16 27
? 16 33
? 16 30
? 16 32
? 16 31
? 21 31
! 11 31
? 12 35
? 12 34
? 12 23
? 12 29
? 12 26
? 12 28
? 20 29
! 4 29
? 16 39
? 16 38
? 16 5
? 16 45
? 16 42
? 16 40
? 25 39
! 7 39
? 29 6
? 29 5
? 29 18
? 29 12
? 29 9
? 29 7
? 1 6
! 11 6
? 38 15
? 38 14
? 38 27
? 38 21
? 38 18
? 38 1...

result:

ok ok (1000 test cases)

Test #17:

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

input:

1000
1000000000
499999999
499999999
249999999
125000000
187500000
218750000
234374999
226562499
222656250
224609375
225585938
226074218
225830079
225952148
225891113
225860597
225875855
225868226
225864412
225866320
225867273
225866797
225867035
225866916
225866857
225866886
225866872
225866879
2258...

output:

? 97914260 597914260
? 97914260 597914259
? 97914260 847914260
? 97914260 972914260
? 97914260 910414260
? 97914260 879164260
? 97914260 863539260
? 97914260 871351760
? 97914260 875258010
? 97914260 873304885
? 97914260 872328322
? 97914260 871840041
? 97914260 872084181
? 97914260 871962111
? 9791...

result:

ok ok (1000 test cases)

Test #18:

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

input:

1000
1000000000
499999969
499999970
249999969
125000000
187500000
218749969
203125000
210937469
207031250
208984375
209960938
210449188
210205048
210082978
210021943
209991425
209976197
209983827
209987611
209985735
209986658
209986181
209985974
209986062
209986034
209986049
209986048
209986041
2099...

output:

? 613236945 113236945
? 613236945 113236944
? 613236945 363236945
? 613236945 488236945
? 613236945 425736945
? 613236945 394486945
? 613236945 410111945
? 613236945 402299445
? 613236945 406205695
? 613236945 404252570
? 613236945 403276007
? 613236945 402787726
? 613236945 403031866
? 613236945 40...

result:

ok ok (1000 test cases)

Test #19:

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

input:

1000
1000000000
363543141
363543140
250000000
238543141
187500001
207293141
191668141
183855641
183593751
181902516
182617188
182128907
181884766
181780446
181823731
181793213
181777954
181772817
181774139
181772232
181771864
181771755
181771626
181771635
181771575
181771597
181771582
181771575
1817...

output:

? 918845666 418845666
? 918845666 418845665
? 918845666 168845666
? 918845666 293845666
? 918845666 231345666
? 918845666 262595666
? 918845666 246970666
? 918845666 239158166
? 918845666 235251916
? 918845666 237205041
? 918845666 236228479
? 918845666 236716760
? 918845666 236960901
? 918845666 23...

result:

ok ok (1000 test cases)

Test #20:

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

input:

1000
1000000000
107691748
107691747
249999930
124999930
62499930
76441748
60816748
54687430
56910498
54957373
53980811
54199148
53955007
53858741
53893972
53863454
53848195
53851112
53847298
53846287
53846345
53845868
53846048
53845929
53845869
53845839
53845854
53845846
53845842
53845840
107691677
...

output:

? 438603184 938603184
? 438603184 938603183
? 438603184 688603184
? 438603184 813603184
? 438603184 876103184
? 438603184 907353184
? 438603184 891728184
? 438603184 883915684
? 438603184 887821934
? 438603184 885868809
? 438603184 884892247
? 438603184 884403966
? 438603184 884648107
? 438603184 88...

result:

ok ok (1000 test cases)

Test #21:

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

input:

1000
1000000000
288090905
288090904
225907351
163090905
163407351
132157351
147465905
139653405
135747155
133794030
132817468
132329187
132085046
132035280
132024011
132004762
132008753
132001124
132000947
131999217
131999993
131999516
131999277
131999158
131999158
131999128
131999143
131999135
1319...

output:

? 614219728 114219728
? 614219728 114219727
? 614219728 864219728
? 614219728 989219728
? 614219728 926719728
? 614219728 957969728
? 614219728 973594728
? 614219728 965782228
? 614219728 961875978
? 614219728 959922853
? 614219728 958946291
? 614219728 958458010
? 614219728 958213869
? 614219728 95...

result:

ok ok (1000 test cases)

Test #22:

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

input:

1000
999999999
499999999
499999999
499999999
499999998
499999997
249999999
374999999
437499999
468749999
484374998
476562499
480468749
482421873
481445312
481933593
482177734
482299804
482360839
482391356
482376098
482383728
482387543
482389449
482388497
482388973
482388735
482388616
482388557
48238...

output:

? 592665135 92665135
? 676033216 176033216
? 379717682 879717681
? 736229959 236229959
? 736229959 236229958
? 736229959 986229958
? 736229959 111229959
? 736229959 173729959
? 736229959 204979959
? 736229959 220604959
? 736229959 212792459
? 736229959 216698709
? 736229959 218651834
? 736229959 217...

result:

ok ok (1000 test cases)

Test #23:

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

input:

1000
999999999
499999956
499999955
249999956
124999956
62499956
31249956
15624956
7812499
11718706
9765624
10742144
10253863
10009765
10131836
10192828
10162311
10147052
10139423
10135651
10137516
10136562
10136128
10136324
10136248
10136308
10136305
10136310
10136303
10136301
10136301
10136300
1
1
...

output:

? 678039839 178039839
? 678039839 178039838
? 678039839 928039838
? 678039839 803039838
? 678039839 740539838
? 678039839 709289838
? 678039839 693664838
? 678039839 685852338
? 678039839 689758588
? 678039839 687805463
? 678039839 688782026
? 678039839 688293745
? 678039839 688049604
? 678039839 68...

result:

ok ok (1000 test cases)

Test #24:

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

input:

1000
999999999
496536319
496536318
249999999
371536319
309036319
277786319
262161319
254348819
250442569
248489444
249023438
248535157
248291016
248367374
248306339
248275822
248275757
248268193
248271942
248270034
248269080
248268603
248268365
248268246
248268186
248268164
248268171
248268163
24826...

output:

? 410541132 910541131
? 410541132 910541130
? 410541132 660541131
? 410541132 785541131
? 410541132 723041131
? 410541132 691791131
? 410541132 676166131
? 410541132 668353631
? 410541132 664447381
? 410541132 662494256
? 410541132 661517694
? 410541132 662005975
? 410541132 662250116
? 410541132 66...

result:

ok ok (1000 test cases)

Test #25:

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

input:

1000
999999999
492196849
492196848
249999999
367196849
304696849
273446849
257821849
250009349
246103099
248046942
247070379
246582098
246337957
246215887
246154852
246124334
246109075
246101446
246099285
246099538
246098584
246098809
246098571
246098464
246098512
246098482
246098467
246098460
24609...

output:

? 2590884 502590883
? 2590884 502590882
? 2590884 252590883
? 2590884 377590883
? 2590884 315090883
? 2590884 283840883
? 2590884 268215883
? 2590884 260403383
? 2590884 256497133
? 2590884 254544008
? 2590884 255520571
? 2590884 256008852
? 2590884 256252993
? 2590884 256375063
? 2590884 256436098
...

result:

ok ok (1000 test cases)

Test #26:

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

input:

1000
999999999
478441553
478441552
249999999
374264885
415941553
384691553
369066553
366452385
365160303
364499260
364183741
364010978
363939601
363888907
363878566
363858389
363863308
363855679
363854574
363853772
363853620
363853295
363853381
363853262
363853236
363853232
363853221
363853224
36385...

output:

? 371863341 871863340
? 371863341 871863339
? 371863341 621863340
? 371863341 746863340
? 371863341 809363340
? 371863341 778113340
? 371863341 762488340
? 371863341 754675840
? 371863341 758582090
? 371863341 756628965
? 371863341 757605528
? 371863341 757117247
? 371863341 757361388
? 371863341 75...

result:

ok ok (1000 test cases)

Test #27:

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

input:

1000
536870912
217743733
217743732
134217728
175464669
184189301
167412085
167076061
163217781
164978909
163930333
163406045
163143901
163086709
163078365
163053941
163061981
163053789
163049845
163051741
163050717
163050205
163049949
163049821
163049781
163049789
163049773
163049773
163049769
16304...

output:

? 514932145 246496689
? 514932145 246496688
? 514932145 112278961
? 514932145 179387825
? 514932145 212942257
? 514932145 196165041
? 514932145 187776433
? 514932145 191970737
? 514932145 189873585
? 514932145 190922161
? 514932145 191446449
? 514932145 191708593
? 514932145 191839665
? 514932145 19...

result:

ok ok (1000 test cases)

Test #28:

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

input:

1000
536870911
244408484
244408483
134217727
201326591
210854052
218103807
210272556
206659748
208175404
207126828
206602540
206397604
206471468
206405932
206373164
206381220
206373028
206369068
206370980
206369956
206369444
206369188
206369060
206369004
206369028
206369012
206369004
206369000
20636...

output:

? 242094968 510530423
? 242094968 510530422
? 242094968 376312695
? 242094968 443421559
? 242094968 476975991
? 242094968 460198775
? 242094968 468587383
? 242094968 472781687
? 242094968 470684535
? 242094968 471733111
? 242094968 472257399
? 242094968 472519543
? 242094968 472388471
? 242094968 47...

result:

ok ok (1000 test cases)

Extra Test:

score: 0
Extra Test Passed