QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#882660#9734. Identify ChordrbtreeWA 66ms3712kbC++265.7kb2025-02-05 10:33:042025-02-05 10:33:08

Judging History

This is the latest submission verdict.

  • [2025-02-05 10:33:08]
  • Judged
  • Verdict: WA
  • Time: 66ms
  • Memory: 3712kb
  • [2025-02-05 10:33:04]
  • 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[]) {
}

// :\ */

詳細信息

Test #1:

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

input:

2
6
3
2
2
2
1
1
4
2
1
1

output:

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

result:

ok ok (2 test cases)

Test #2:

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

input:

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

output:

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

result:

ok ok (1000 test cases)

Test #3:

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

input:

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

output:

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

result:

ok ok (1000 test cases)

Test #4:

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

input:

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

output:

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

result:

ok ok (1000 test cases)

Test #5:

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

input:

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

output:

? 20 5
? 20 4
? 20 27
? 20 2
? 20 3
? 22 3
! 22 3
? 14 28
? 14 27
? 14 21
? 14 25
? 14 23
? 14 24
? 20 24
! 8 24
? 29 14
? 29 13
? 29 22
? 29 18
? 29 16
? 29 17
? 2 17
! 2 17
? 24 9
? 24 8
? 24 16
? 24 12
? 24 14
? 24 13
? 2 13
! 2 13
? 13 27
? 13 26
? 13 20
? 13 24
? 13 22
? 13 23
? 14 23
! 14 23
?...

result:

ok ok (1000 test cases)

Test #6:

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

input:

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

output:

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

result:

ok ok (1000 test cases)

Test #7:

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

input:

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

output:

? 5 22
? 5 21
? 5 31
? 5 1
? 5 33
? 5 32
! 5 31
? 8 24
? 8 23
? 8 16
? 8 12
? 8 14
? 8 15
? 10 15
! 6 15
? 33 16
? 33 15
? 33 24
? 33 28
? 33 26
? 33 25
? 2 24
! 31 24
? 27 10
? 27 9
? 27 19
? 27 14
? 27 12
? 27 11
? 32 11
! 32 11
? 1 18
? 1 17
? 1 27
? 1 31
? 1 29
? 1 28
? 2 27
! 2 27
? 15 32
? 15 ...

result:

ok ok (1000 test cases)

Test #8:

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

input:

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

output:

? 26 8
? 26 7
? 26 17
? 26 22
? 26 19
? 26 18
? 32 18
! 20 18
? 16 34
? 16 33
? 16 7
? 16 2
? 16 36
? 16 35
? 19 35
! 19 35
? 3 21
? 3 20
? 3 12
? 3 7
? 3 10
? 3 9
? 4 10
! 4 10
? 11 29
? 11 28
? 11 2
? 11 7
? 11 4
? 11 3
? 17 3
! 17 3
? 16 34
? 16 33
? 16 25
? 16 30
? 16 32
? 16 31
? 26 32
! 6 32
?...

result:

ok ok (1000 test cases)

Test #9:

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

input:

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

output:

? 19 37
? 19 36
? 19 28
? 19 23
? 19 26
? 19 27
? 24 27
! 14 27
? 23 5
? 23 4
? 23 32
? 23 27
? 23 30
? 23 29
? 23 28
? 26 28
! 26 28
? 15 34
? 15 33
? 15 6
? 15 11
? 15 8
? 15 7
? 18 7
! 18 7
? 33 14
? 33 13
? 33 5
? 33 10
? 33 12
? 8 13
! 21 13
? 28 9
? 28 8
? 28 18
? 28 23
? 28 20
? 28 19
? 29 19...

result:

ok ok (1000 test cases)

Test #10:

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

input:

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

output:

? 11 30
? 11 29
? 11 20
? 11 25
? 11 23
? 11 24
? 13 25
! 13 25
? 18 37
? 18 36
? 18 27
? 18 32
? 18 35
? 18 34
? 18 33
? 21 33
! 21 33
? 9 28
? 9 27
? 9 18
? 9 23
? 9 26
? 9 25
? 15 26
! 15 26
? 2 21
? 2 20
? 2 11
? 2 6
? 2 9
? 2 10
! 2 10
? 10 29
? 10 28
? 10 19
? 10 24
? 10 27
? 10 26
? 10 25
? 2...

result:

ok ok (1000 test cases)

Test #11:

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

input:

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

output:

? 24 4
? 24 3
? 24 14
? 24 9
? 24 6
? 24 7
? 24 8
? 26 7
! 26 7
? 20 40
? 5 25
? 5 24
? 5 35
? 5 30
? 5 27
? 5 28
? 12 27
! 12 27
? 34 14
? 34 13
? 34 4
? 34 39
? 34 2
? 34 3
? 35 3
! 33 3
? 29 9
? 29 8
? 29 19
? 29 14
? 29 16
? 29 15
? 1 14
! 1 14
? 23 3
? 23 2
? 23 33
? 23 28
? 23 25
? 23 27
! 23 ...

result:

ok ok (1000 test cases)

Test #12:

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

input:

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

output:

? 31 10
? 31 9
? 31 41
? 31 5
? 31 8
? 31 7
? 31 6
? 3 6
! 17 6
? 17 37
? 17 36
? 17 6
? 17 1
? 17 39
? 17 38
? 33 38
! 33 38
? 1 21
? 1 20
? 1 11
? 1 16
? 1 14
? 1 15
? 3 16
! 40 16
? 40 19
? 40 18
? 40 9
? 40 14
? 40 17
? 40 16
? 40 15
? 3 16
! 36 16
? 39 18
? 39 17
? 39 28
? 39 23
? 39 25
? 39 24...

result:

ok ok (1000 test cases)

Test #13:

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

input:

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

output:

? 36 14
? 36 13
? 36 25
? 36 19
? 36 22
? 36 20
? 36 21
? 3 21
! 3 21
? 15 36
? 15 35
? 15 25
? 15 20
? 15 17
? 15 19
? 16 20
! 16 20
? 20 41
? 20 40
? 20 9
? 20 3
? 20 6
? 20 4
? 20 5
? 21 5
! 21 5
? 19 40
? 19 39
? 19 29
? 19 35
? 19 32
? 19 34
? 24 35
! 14 35
? 25 3
? 25 2
? 25 14
? 25 8
? 25 5
?...

result:

ok ok (1000 test cases)

Test #14:

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

input:

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

output:

? 26 4
? 26 3
? 26 15
? 26 9
? 26 6
? 26 7
? 41 6
! 41 6
? 39 17
? 5 27
? 5 26
? 5 38
? 5 32
? 5 29
? 5 30
! 5 29
? 12 33
? 12 32
? 12 1
? 12 38
? 12 35
? 12 36
? 12 37
? 24 36
! 24 36
? 12 33
? 12 32
? 12 22
? 12 28
? 12 25
? 12 27
? 18 28
! 18 28
? 38 16
? 38 15
? 38 5
? 38 43
? 38 2
? 38 1
? 40 2...

result:

ok ok (1000 test cases)

Test #15:

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

input:

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

output:

? 41 18
? 41 17
? 41 7
? 41 1
? 41 4
? 41 6
? 41 5
? 45 5
! 45 5
? 19 41
? 19 40
? 19 7
? 19 1
? 19 43
? 19 42
? 26 42
! 12 42
? 21 43
? 21 42
? 21 9
? 21 3
? 21 6
? 21 4
? 21 5
? 24 5
! 18 5
? 32 9
? 32 8
? 32 43
? 32 4
? 32 7
? 32 6
? 32 5
! 32 6
? 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: 11ms
memory: 3584kb

input:

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

output:

? 45 22
? 45 21
? 45 34
? 45 28
? 45 31
? 45 32
? 11 31
! 11 31
? 34 11
? 34 10
? 34 45
? 34 5
? 34 2
? 34 4
? 34 3
? 39 4
! 29 4
? 10 33
? 10 32
? 10 45
? 10 39
? 10 42
? 10 40
? 13 39
! 7 39
? 33 10
? 33 9
? 33 22
? 33 16
? 33 13
? 33 11
? 33 12
? 6 11
! 6 11
? 28 5
? 28 4
? 28 39
? 28 45
? 28 2
?...

result:

ok ok (1000 test cases)

Test #17:

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

input:

1000
1000000000
499999999
499999998
250000000
374999999
312500000
343749999
328125000
335937500
339843750
341796874
340820313
341308594
341552734
341430664
341369630
341400147
341384889
341392519
341396333
341394427
341395381
341395857
341395619
341395500
341395441
341395470
341395456
341395463
3413...

output:

? 530651924 30651924
? 530651924 30651923
? 530651924 780651924
? 530651924 905651924
? 530651924 843151924
? 530651924 874401924
? 530651924 858776924
? 530651924 866589424
? 530651924 870495674
? 530651924 872448799
? 530651924 871472237
? 530651924 871960518
? 530651924 872204659
? 530651924 8720...

result:

ok ok (1000 test cases)

Test #18:

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

input:

1000
1000000000
499999969
499999970
250000000
375000000
437499969
406250000
421874969
414062469
410156250
412109375
413085938
413574219
413818329
413696259
413635224
413604737
413619965
413612336
413608521
413606614
413605660
413605183
413604945
413604857
413604886
413604860
413604871
413604864
4136...

output:

? 816855762 316855762
? 816855762 316855761
? 816855762 566855762
? 816855762 441855762
? 816855762 379355762
? 816855762 410605762
? 816855762 394980762
? 816855762 402793262
? 816855762 406699512
? 816855762 404746387
? 816855762 403769824
? 816855762 403281543
? 816855762 403037402
? 816855762 40...

result:

ok ok (1000 test cases)

Test #19:

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

input:

1000
1000000000
411877531
411877532
250000000
286877531
224377531
218750001
208752531
210937501
207031251
206799406
206054688
206311125
206066985
205944915
205993652
205963134
205947875
205940246
205941101
205939194
205939292
205938815
205938956
205938837
205938777
205938785
205938770
205938770
2059...

output:

? 31135331 531135331
? 31135331 531135330
? 31135331 781135331
? 31135331 656135331
? 31135331 718635331
? 31135331 749885331
? 31135331 734260331
? 31135331 742072831
? 31135331 738166581
? 31135331 736213456
? 31135331 737190018
? 31135331 736701737
? 31135331 736945877
? 31135331 737067947
? 3113...

result:

ok ok (1000 test cases)

Test #20:

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

input:

1000
1000000000
399295558
399295559
249999930
274295558
211795558
218749930
203124930
203983058
200076808
201171805
200195242
199706961
199832668
199710598
199649563
199676443
199661184
199653554
199649739
199647832
199648610
199648133
199647895
199647776
199647772
199647746
199647757
199647749
1996...

output:

? 685109532 185109532
? 685109532 185109531
? 685109532 435109532
? 685109532 310109532
? 685109532 372609532
? 685109532 403859532
? 685109532 388234532
? 685109532 380422032
? 685109532 384328282
? 685109532 386281407
? 685109532 385304844
? 685109532 384816563
? 685109532 384572422
? 685109532 38...

result:

ok ok (1000 test cases)

Test #21:

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

input:

1000
1000000000
288090905
288090906
250000000
180670685
225590905
194340905
178715905
172858185
174809655
172856530
171881622
172368249
172124109
172002039
171941004
171910486
171895227
171887598
171883783
171881876
171880922
171881145
171880906
171880803
171880846
171880816
171880801
171880796
1718...

output:

? 130008745 630008745
? 130008745 630008744
? 130008745 880008745
? 130008745 755008745
? 130008745 692508745
? 130008745 723758745
? 130008745 739383745
? 130008745 747196245
? 130008745 743289995
? 130008745 745243120
? 130008745 746219682
? 130008745 745731401
? 130008745 745975541
? 130008745 74...

result:

ok ok (1000 test cases)

Test #22:

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

input:

1000
999999999
499999998
499999997
249999998
124999998
62499998
31249998
15624999
23437499
27343749
29296873
28320311
27832031
28076171
27954101
27893066
27862549
27877807
27870179
27873994
27875900
27874947
27874471
27874709
27874590
27874531
27874560
27874546
27874553
27874550
27874552
27874553
1
...

output:

? 190743994 690743993
? 190743994 690743992
? 190743994 440743993
? 190743994 315743993
? 190743994 253243993
? 190743994 221993993
? 190743994 206368993
? 190743994 214181493
? 190743994 218087743
? 190743994 220040868
? 190743994 219064306
? 190743994 218576025
? 190743994 218820166
? 190743994 21...

result:

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