QOJ.ac

QOJ

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

Judging History

This is the latest submission verdict.

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

// :\ */

詳細信息

Test #1:

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

input:

2
6
2
2
2
1
1
4
2
1
1

output:

? 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: 15ms
memory: 3584kb

input:

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

output:

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

result:

ok ok (1000 test cases)

Test #3:

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

input:

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

output:

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

result:

ok ok (1000 test cases)

Test #4:

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

input:

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

output:

? 15 2
? 15 1
? 15 21
? 15 24
? 15 25
? 24 1
! 6 1
? 24 11
? 24 10
? 24 5
? 24 8
? 24 9
? 25 9
! 25 9
? 3 15
? 25 12
? 25 11
? 25 6
? 25 3
? 25 5
? 2 6
! 23 6
? 16 3
? 16 2
? 16 9
? 16 6
? 16 4
? 21 3
! 11 3
? 26 13
? 26 12
? 26 20
? 26 16
? 26 18
? 26 19
? 6 18
! 20 18
? 19 6
? 19 5
? 19 13
? 19 9
...

result:

ok ok (1000 test cases)

Test #5:

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

input:

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

output:

? 13 27
? 9 23
? 9 22
? 9 16
? 9 20
? 9 21
? 15 22
! 3 22
? 21 7
? 21 6
? 21 14
? 21 10
? 21 8
? 21 9
? 24 8
! 24 8
? 16 1
? 16 30
? 16 9
? 16 5
? 16 3
? 16 2
? 17 2
! 17 2
? 13 27
? 13 26
? 13 5
? 13 1
? 13 3
? 13 2
! 13 2
? 5 19
? 21 7
? 21 6
? 21 14
? 21 18
? 21 16
? 21 15
? 23 14
! 23 14
? 22 7
...

result:

ok ok (1000 test cases)

Test #6:

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

input:

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

output:

? 24 8
? 24 7
? 24 16
? 24 12
? 24 10
? 24 9
? 5 9
! 5 9
? 18 3
? 18 2
? 18 25
? 18 29
? 18 27
? 18 28
? 26 28
! 26 28
? 5 21
? 5 20
? 5 29
? 5 25
? 5 27
? 5 26
? 9 26
! 9 26
? 24 8
? 24 7
? 24 31
? 24 4
? 24 2
? 24 3
? 2 4
! 15 4
? 21 5
? 21 4
? 21 29
? 21 1
? 21 3
? 21 2
! 21 3
? 20 4
? 20 3
? 20 ...

result:

ok ok (1000 test cases)

Test #7:

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

input:

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

output:

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

result:

ok ok (1000 test cases)

Test #8:

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

input:

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

output:

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

result:

ok ok (1000 test cases)

Test #9:

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

input:

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

output:

? 36 17
? 36 16
? 36 8
? 36 13
? 36 15
? 36 14
? 8 14
! 27 14
? 36 18
? 36 17
? 36 27
? 36 22
? 36 24
? 36 25
? 36 26
? 8 26
! 28 26
? 30 11
? 30 10
? 30 1
? 30 6
? 30 9
? 30 8
? 30 7
? 4 7
! 18 7
? 26 7
? 26 6
? 26 16
? 26 11
? 26 13
? 26 14
? 31 13
! 21 13
? 27 8
? 27 7
? 27 17
? 27 22
? 27 19
? 2...

result:

ok ok (1000 test cases)

Test #10:

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

input:

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

output:

? 26 6
? 26 5
? 26 16
? 26 11
? 26 13
? 26 14
? 27 13
! 25 13
? 17 36
? 17 35
? 17 26
? 17 31
? 17 34
? 17 33
? 17 32
? 21 33
! 21 33
? 4 23
? 4 22
? 4 33
? 4 28
? 4 25
? 4 26
? 4 27
? 15 26
! 15 26
? 17 36
? 17 35
? 17 7
? 17 2
? 17 4
? 17 3
? 24 2
! 10 2
? 33 14
? 33 13
? 33 24
? 33 19
? 33 21
? 3...

result:

ok ok (1000 test cases)

Test #11:

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

input:

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

output:

? 40 20
? 40 19
? 40 30
? 40 25
? 40 27
? 40 26
? 7 26
! 7 26
? 15 35
? 15 34
? 15 25
? 15 30
? 15 28
? 15 27
? 15 26
? 18 27
! 12 27
? 25 5
? 25 4
? 25 35
? 25 40
? 25 3
? 25 2
? 33 3
! 33 3
? 40 20
? 40 19
? 40 10
? 40 15
? 40 13
? 40 14
? 1 14
! 1 14
? 14 34
? 14 33
? 14 24
? 14 29
? 14 27
? 14 2...

result:

ok ok (1000 test cases)

Test #12:

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

input:

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

output:

? 25 4
? 25 3
? 25 15
? 25 9
? 25 6
? 25 7
? 33 6
! 17 6
? 7 27
? 7 26
? 7 37
? 7 32
? 7 34
? 7 33
? 17 33
! 38 33
? 33 12
? 33 11
? 33 22
? 33 17
? 33 14
? 33 15
? 33 16
? 40 16
! 40 16
? 24 3
? 24 2
? 24 34
? 24 39
? 24 37
? 24 36
? 24 35
? 32 36
! 16 36
? 22 1
? 22 41
? 22 11
? 22 6
? 22 8
? 22 9...

result:

ok ok (1000 test cases)

Test #13:

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

input:

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

output:

? 7 28
? 7 27
? 7 17
? 7 23
? 7 20
? 7 22
? 7 21
? 11 21
! 3 21
? 7 28
? 7 27
? 7 17
? 7 23
? 7 20
? 7 19
? 16 20
! 16 20
? 10 31
? 10 30
? 10 20
? 10 26
? 10 23
? 10 22
? 10 21
? 15 21
! 5 21
? 34 12
? 34 11
? 34 23
? 34 17
? 34 14
? 34 15
? 35 14
! 35 14
? 24 2
? 24 1
? 24 13
? 24 7
? 24 4
? 24 5
...

result:

ok ok (1000 test cases)

Test #14:

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

input:

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

output:

? 40 18
? 40 17
? 40 7
? 40 1
? 40 4
? 40 6
? 40 5
? 41 6
! 41 6
? 32 10
? 32 9
? 32 43
? 32 5
? 32 2
? 32 4
? 35 5
! 29 5
? 34 12
? 34 11
? 34 23
? 34 28
? 34 25
? 34 24
? 36 24
! 36 24
? 2 23
? 33 11
? 33 10
? 33 22
? 33 16
? 33 19
? 33 17
? 33 18
? 38 18
! 28 18
? 23 1
? 23 44
? 23 12
? 23 6
? 23...

result:

ok ok (1000 test cases)

Test #15:

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

input:

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

output:

? 41 18
? 41 17
? 41 7
? 41 1
? 41 4
? 41 6
? 41 5
? 45 5
! 45 5
? 39 16
? 39 15
? 39 5
? 39 11
? 39 14
? 39 13
? 39 12
? 42 12
! 42 12
? 35 12
? 25 2
? 25 1
? 25 13
? 25 7
? 25 4
? 25 5
? 25 6
? 32 5
! 18 5
? 29 6
? 29 5
? 29 17
? 29 11
? 29 8
? 29 7
? 32 6
! 32 6
? 32 9
? 32 8
? 32 20
? 32 14
? 32...

result:

ok ok (1000 test cases)

Test #16:

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

input:

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

output:

? 14 37
? 14 36
? 14 25
? 14 31
? 14 28
? 14 30
? 17 31
! 11 31
? 38 15
? 38 14
? 38 3
? 38 9
? 38 6
? 38 5
? 38 4
? 1 4
! 29 4
? 10 33
? 10 32
? 10 45
? 10 39
? 10 42
? 10 40
? 13 39
! 7 39
? 26 3
? 26 2
? 26 15
? 26 9
? 26 6
? 26 7
? 41 6
! 11 6
? 10 33
? 34 11
? 2 25
? 2 24
? 2 13
? 2 19
? 2 22
?...

result:

ok ok (1000 test cases)

Test #17:

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

input:

1000
1000000000
499999999
499999998
250000000
374999999
312499999
281249999
265624999
257812500
261718750
263671874
262695313
263183594
263427735
263549805
263610839
263580323
263595582
263603211
263607025
263605118
263604164
263603687
263603450
263603569
263603629
263603658
263603644
263603652
2636...

output:

? 608443727 108443727
? 608443727 108443726
? 608443727 858443727
? 608443727 983443727
? 608443727 920943727
? 608443727 889693727
? 608443727 874068727
? 608443727 866256227
? 608443727 870162477
? 608443727 872115602
? 608443727 871139040
? 608443727 871627321
? 608443727 871871462
? 608443727 87...

result:

ok ok (1000 test cases)

Test #18:

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

input:

1000
1000000000
499999969
499999968
250000000
374999969
312500000
343750000
359375000
367187469
363281250
365234344
364257813
364746063
364501954
364624024
364685028
364654542
364669770
364662141
364658326
364656450
364657404
364657881
364658088
364657969
364657910
364657892
364657895
364657888
3646...

output:

? 38592988 538592988
? 38592988 538592987
? 38592988 288592988
? 38592988 413592988
? 38592988 351092988
? 38592988 382342988
? 38592988 397967988
? 38592988 405780488
? 38592988 401874238
? 38592988 403827363
? 38592988 402850801
? 38592988 403339082
? 38592988 403094942
? 38592988 403217012
? 3859...

result:

ok ok (1000 test cases)

Test #19:

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

input:

1000
1000000000
218479435
218479436
250000000
125000001
155979435
124729435
109375001
116916935
113010685
111057560
110080998
109592717
109348576
109252930
109287541
109257024
109241765
109245300
109241485
109239858
109240531
109240054
109239816
109239739
109239756
109239726
109239725
109239718
1092...

output:

? 127834379 627834379
? 127834379 627834378
? 127834379 877834379
? 127834379 752834379
? 127834379 690334379
? 127834379 721584379
? 127834379 737209379
? 127834379 729396879
? 127834379 733303129
? 127834379 735256254
? 127834379 736232816
? 127834379 736721097
? 127834379 736965238
? 127834379 73...

result:

ok ok (1000 test cases)

Test #20:

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

input:

1000
1000000000
140964862
140964863
250000000
125000072
78464862
93750072
78125072
70652362
74218822
72265697
71289134
70800853
70556712
70530292
70495677
70499775
70484516
70488047
70484232
70482609
70483278
70482801
70482563
70482490
70482503
70482473
70482476
70482469
70482469
70482467
70482468
1...

output:

? 314274880 814274880
? 314274880 814274879
? 314274880 64274880
? 314274880 939274880
? 314274880 876774880
? 314274880 908024880
? 314274880 892399880
? 314274880 884587380
? 314274880 888493630
? 314274880 886540505
? 314274880 885563942
? 314274880 885075661
? 314274880 884831520
? 314274880 884...

result:

ok ok (1000 test cases)

Test #21:

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

input:

1000
1000000000
382233183
382233182
250000000
375000000
350590905
350983183
335358183
342778405
338872155
336919030
335942467
335454186
335210045
335236113
335175078
335179527
335164268
335167449
335163635
335162360
335162682
335162205
335162121
335162086
335162061
335162057
335162046
335162050
3351...

output:

? 293289994 793289994
? 293289994 793289993
? 293289994 543289994
? 293289994 668289994
? 293289994 730789994
? 293289994 762039994
? 293289994 746414994
? 293289994 738602494
? 293289994 742508744
? 293289994 744461869
? 293289994 745438432
? 293289994 745926713
? 293289994 746170854
? 293289994 74...

result:

ok ok (1000 test cases)

Test #22:

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

input:

1000
999999999
499999998
499999997
249999998
124999998
62499998
31249999
46874998
39062498
35156248
33203123
32226561
31738281
31982421
31860351
31799317
31829835
31845093
31837465
31841279
31839372
31838419
31838896
31839135
31839253
31839194
31839164
31839150
31839158
31839162
31839163
31839162
1
...

output:

? 186779385 686779384
? 186779385 686779383
? 186779385 436779384
? 186779385 311779384
? 186779385 249279384
? 186779385 218029384
? 186779385 233654384
? 186779385 225841884
? 186779385 221935634
? 186779385 219982509
? 186779385 219005947
? 186779385 218517666
? 186779385 218761807
? 186779385 21...

result:

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