QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#882745#9734. Identify ChordrbtreeAC ✓80ms3584kbC++265.3kb2025-02-05 11:06:052025-02-05 11:06:08

Judging History

This is the latest submission verdict.

  • [2025-02-05 11:06:08]
  • Judged
  • Verdict: AC
  • Time: 80ms
  • Memory: 3584kb
  • [2025-02-05 11:06:05]
  • 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

// :/

// :/

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;
   mt19937 rng(217);
   while (true) {
      x = rng() % n;
      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: 1ms
memory: 3456kb

input:

2
6
3
2
2
2
2
1
4
1
1

output:

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

result:

ok ok (2 test cases)

Test #2:

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

input:

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

output:

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

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
8
9
4
5
4
3
1
1
20
5
6
2
3
2
1
1
22
10
10
5
7
7
1
1
21
9
8
4
2
3
3
2
1
21
7
8
6
9
8
1
1
24
11
11
6
8
8
1
1
22
10
10
5
8
9
9
4
1
21
9
9
6
7
6
5
1
1
23
7
6
5
8
7
1
1
21
6
5
3
4
3
2
3
1
24
7
6
6
8
7
1
1
20
9
8
4
1
1
24
11
10
6
8
8
1
1
23
9
10
6
9
10
3
1
23
6
7
6
5
5
4
1
1
23
9
...

output:

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

result:

ok ok (1000 test cases)

Test #4:

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

input:

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

output:

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

result:

ok ok (1000 test cases)

Test #5:

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

input:

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

output:

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

result:

ok ok (1000 test cases)

Test #6:

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

input:

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

output:

? 19 3
? 19 2
? 19 11
? 19 7
? 19 5
? 19 6
? 29 5
! 9 5
? 21 6
? 21 5
? 21 28
? 21 24
? 21 26
? 21 27
? 26 28
! 26 28
? 19 3
? 19 2
? 19 11
? 19 7
? 19 9
? 19 10
? 26 9
! 26 9
? 21 5
? 21 4
? 21 28
? 21 1
? 21 3
? 27 4
! 15 4
? 19 3
? 19 2
? 19 11
? 19 7
? 19 5
? 19 4
? 21 3
! 21 3
? 19 3
? 19 2
? 1...

result:

ok ok (1000 test cases)

Test #7:

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

input:

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

output:

? 31 14
? 31 13
? 31 5
? 31 1
? 31 3
? 31 4
! 31 5
? 12 28
? 12 27
? 12 3
? 12 7
? 12 5
? 12 6
? 15 6
! 15 6
? 12 28
? 23 6
? 23 5
? 23 31
? 23 27
? 23 29
? 23 30
? 24 31
! 24 31
? 31 14
? 31 13
? 31 5
? 31 10
? 31 12
? 31 11
? 32 11
! 32 11
? 31 14
? 29 12
? 29 11
? 29 3
? 29 33
? 29 1
? 29 2
? 31 ...

result:

ok ok (1000 test cases)

Test #8:

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

input:

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

output:

? 15 33
? 15 32
? 15 24
? 15 19
? 15 22
? 15 21
? 15 20
? 18 20
! 18 20
? 15 33
? 15 32
? 15 6
? 15 1
? 15 35
? 15 36
? 19 35
! 19 35
? 15 33
? 15 32
? 15 6
? 15 1
? 15 3
? 15 4
? 15 5
? 20 4
! 10 4
? 15 33
? 15 32
? 15 6
? 15 1
? 15 3
? 15 4
? 17 3
! 17 3
? 15 33
? 15 32
? 15 24
? 15 29
? 15 31
? 2...

result:

ok ok (1000 test cases)

Test #9:

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

input:

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

output:

? 18 36
? 18 35
? 18 27
? 18 22
? 18 25
? 18 26
? 22 27
! 14 27
? 15 33
? 15 32
? 15 24
? 15 29
? 15 27
? 15 28
? 26 28
! 26 28
? 29 10
? 29 9
? 29 38
? 29 5
? 29 8
? 29 7
? 29 6
? 2 7
! 18 7
? 18 36
? 12 30
? 12 29
? 12 21
? 12 16
? 12 19
? 12 20
? 13 21
! 13 21
? 18 36
? 18 35
? 18 27
? 18 22
? 18...

result:

ok ok (1000 test cases)

Test #10:

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

input:

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

output:

? 39 19
? 26 6
? 26 5
? 26 16
? 26 11
? 26 13
? 26 14
? 27 13
! 25 13
? 29 10
? 29 9
? 29 20
? 29 25
? 29 22
? 29 21
? 33 21
! 33 21
? 29 10
? 29 9
? 29 20
? 29 15
? 29 17
? 29 16
? 32 15
! 26 15
? 39 19
? 39 18
? 39 9
? 39 14
? 39 12
? 39 11
? 39 10
? 2 10
! 2 10
? 29 10
? 29 9
? 29 20
? 29 25
? 29...

result:

ok ok (1000 test cases)

Test #11:

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

input:

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

output:

? 11 31
? 11 30
? 11 21
? 11 26
? 11 24
? 11 25
? 15 26
! 7 26
? 11 31
? 11 30
? 11 21
? 11 26
? 11 29
? 11 28
? 11 27
? 12 27
! 12 27
? 11 31
? 11 30
? 11 1
? 11 36
? 11 33
? 11 34
? 19 33
! 3 33
? 11 31
? 11 30
? 11 1
? 11 6
? 11 3
? 11 2
? 14 1
! 14 1
? 11 31
? 11 30
? 11 21
? 11 26
? 11 29
? 11 ...

result:

ok ok (1000 test cases)

Test #12:

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

input:

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

output:

? 9 30
? 9 29
? 9 19
? 9 14
? 9 17
? 9 16
? 12 17
! 6 17
? 20 40
? 20 39
? 20 30
? 20 35
? 20 38
? 20 37
? 33 38
! 33 38
? 20 40
? 20 39
? 20 9
? 20 4
? 20 1
? 20 41
? 24 40
! 16 40
? 20 40
? 20 39
? 20 30
? 20 35
? 20 38
? 20 37
? 20 36
? 24 36
! 16 36
? 20 40
? 20 39
? 20 9
? 20 14
? 20 11
? 20 10...

result:

ok ok (1000 test cases)

Test #13:

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

input:

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

output:

? 23 1
? 23 43
? 23 12
? 23 6
? 23 3
? 23 4
? 25 3
! 21 3
? 9 30
? 9 29
? 9 19
? 9 25
? 9 22
? 9 21
? 9 20
? 16 20
! 16 20
? 23 1
? 23 43
? 23 12
? 23 6
? 23 3
? 23 4
? 23 5
? 25 5
! 21 5
? 23 1
? 23 43
? 23 33
? 23 39
? 23 36
? 23 35
? 23 34
? 32 35
! 14 35
? 23 1
? 7 28
? 7 27
? 7 39
? 7 1
? 7 41
...

result:

ok ok (1000 test cases)

Test #14:

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

input:

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

output:

? 23 1
? 6 28
? 6 27
? 6 39
? 6 1
? 6 42
? 6 40
? 6 41
! 6 41
? 23 1
? 23 44
? 23 12
? 23 6
? 23 3
? 23 4
? 23 5
? 29 5
! 29 5
? 23 1
? 23 43
? 23 33
? 23 39
? 23 36
? 23 35
? 24 36
! 24 36
? 23 1
? 7 28
? 7 27
? 7 39
? 7 33
? 7 30
? 7 29
? 18 28
! 18 28
? 23 1
? 23 44
? 23 12
? 23 6
? 23 3
? 23 2
?...

result:

ok ok (1000 test cases)

Test #15:

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

input:

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

output:

? 6 28
? 6 27
? 6 39
? 6 45
? 6 3
? 6 1
? 7 45
! 5 45
? 6 28
? 6 27
? 6 39
? 6 45
? 6 42
? 6 43
? 12 42
! 12 42
? 6 28
? 6 27
? 6 17
? 6 23
? 6 20
? 6 19
? 6 18
? 7 18
! 5 18
? 6 28
? 6 27
? 6 39
? 6 33
? 6 30
? 6 31
? 6 32
! 6 32
? 6 28
? 6 27
? 6 17
? 6 11
? 6 14
? 6 13
? 10 14
! 2 14
? 6 28
? 6 2...

result:

ok ok (1000 test cases)

Test #16:

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

input:

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

output:

? 13 36
? 13 35
? 13 24
? 13 30
? 13 33
? 13 32
? 13 31
? 15 31
! 11 31
? 13 36
? 13 35
? 13 24
? 13 30
? 13 27
? 13 29
? 13 28
? 22 29
! 4 29
? 13 36
? 13 35
? 13 2
? 13 42
? 13 39
? 13 40
? 19 39
! 7 39
? 13 36
? 13 35
? 13 2
? 13 8
? 13 5
? 13 6
? 13 7
? 15 6
! 11 6
? 13 36
? 13 35
? 13 2
? 13 42...

result:

ok ok (1000 test cases)

Test #17:

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

input:

1000
1000000000
499999999
499999998
250000000
375000000
437499999
406250000
421875000
429687499
425781250
427734374
426757813
427246093
427001953
426879883
426818849
426849366
426834107
426826478
426822664
426824571
426823618
426824094
426823856
426823738
426823798
426823827
426823812
426823806
4268...

output:

? 445223571 945223571
? 445223571 945223570
? 445223571 695223571
? 445223571 820223571
? 445223571 882723571
? 445223571 851473571
? 445223571 867098571
? 445223571 874911071
? 445223571 871004821
? 445223571 872957946
? 445223571 871981384
? 445223571 872469665
? 445223571 872225525
? 445223571 87...

result:

ok ok (1000 test cases)

Test #18:

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

input:

1000
1000000000
499999969
499999970
249999969
124999969
62499969
31250000
46874969
39062500
42968719
41015625
41992157
41503907
41748048
41870118
41931153
41961671
41976899
41969301
41973085
41971209
41972163
41972640
41972847
41972728
41972669
41972670
41972680
41972672
41972668
41972668
41972667
8...

output:

? 445223571 945223571
? 445223571 945223570
? 445223571 195223571
? 445223571 320223571
? 445223571 382723571
? 445223571 413973571
? 445223571 398348571
? 445223571 406161071
? 445223571 402254821
? 445223571 404207946
? 445223571 403231383
? 445223571 403719664
? 445223571 403475523
? 445223571 40...

result:

ok ok (1000 test cases)

Test #19:

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

input:

1000
1000000000
416298951
416298950
250000000
291298951
228798951
218750001
213173951
210937501
209267701
208984376
208291139
208496094
208251953
208169069
208190918
208160400
208153811
208152770
208149997
208150862
208149908
208149521
208149669
208149550
208149490
208149492
208149477
208149482
2081...

output:

? 445223571 945223571
? 445223571 945223570
? 445223571 695223571
? 445223571 820223571
? 445223571 757723571
? 445223571 726473571
? 445223571 742098571
? 445223571 734286071
? 445223571 738192321
? 445223571 736239196
? 445223571 737215759
? 445223571 736727478
? 445223571 736971619
? 445223571 73...

result:

ok ok (1000 test cases)

Test #20:

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

input:

1000
1000000000
120932522
120932521
249999930
124999930
62499930
89682522
74057522
66245022
62338772
60546805
61362210
60873929
60629788
60507718
60485769
60477201
60470510
60469572
60466695
60467665
60466711
60466234
60466456
60466337
60466277
60466247
60466232
60466227
60466228
60466226
60466227
1...

output:

? 445223571 945223571
? 445223571 945223570
? 445223571 695223571
? 445223571 820223571
? 445223571 882723571
? 445223571 913973571
? 445223571 898348571
? 445223571 890536071
? 445223571 886629821
? 445223571 884676696
? 445223571 885653259
? 445223571 885164978
? 445223571 884920837
? 445223571 88...

result:

ok ok (1000 test cases)

Test #21:

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

input:

1000
1000000000
313899665
313899666
250000000
375000000
350590905
319340905
303715905
306087165
302180915
301762780
301204353
301274498
301030357
301082283
301021248
300999839
301005990
300998361
300996024
300996454
300995500
300995547
300995308
300995381
300995322
300995292
300995293
300995285
3009...

output:

? 445223571 945223571
? 445223571 945223570
? 445223571 195223571
? 445223571 70223571
? 445223571 7723571
? 445223571 976473571
? 445223571 960848571
? 445223571 953036071
? 445223571 956942321
? 445223571 958895446
? 445223571 957918883
? 445223571 958407164
? 445223571 958163023
? 445223571 95804...

result:

ok ok (1000 test cases)

Test #22:

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

input:

1000
999999999
499999999
499999998
499999997
249999998
124999999
187499998
156249999
171874999
179687499
183593749
185546873
184570312
185058592
184814453
184936522
184875488
184906006
184921264
184913636
184917450
184915544
184916497
184916021
184916259
184916140
184916081
184916110
184916095
18491...

output:

? 445223571 945223570
? 33702461 533702460
? 33702461 533702459
? 33702461 283702460
? 33702461 158702460
? 33702461 221202460
? 33702461 189952460
? 33702461 205577460
? 33702461 213389960
? 33702461 217296210
? 33702461 219249335
? 33702461 218272773
? 33702461 218761054
? 33702461 218516914
? 337...

result:

ok ok (1000 test cases)

Test #23:

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

input:

1000
999999999
499999956
499999955
249999956
124999999
187499999
218749999
234374999
242187499
246093706
244140581
243164019
242675781
242919922
243041949
242980914
242950440
242965656
242958027
242954212
242952348
242953259
242952782
242952587
242952663
242952604
242952574
242952577
242952569
24295...

output:

? 445223571 945223570
? 445223571 945223569
? 445223571 695223570
? 445223571 570223570
? 445223571 632723570
? 445223571 663973570
? 445223571 679598570
? 445223571 687411070
? 445223571 691317320
? 445223571 689364195
? 445223571 688387633
? 445223571 687899352
? 445223571 688143493
? 445223571 68...

result:

ok ok (1000 test cases)

Test #24:

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

input:

1000
999999999
434098804
434098805
250000000
309098804
246598804
218750000
230973804
223161304
219255054
217301929
217773437
217285156
217057789
217163085
217102050
217071532
217056273
217050160
217052458
217050551
217049597
217049684
217049446
217049477
217049417
217049417
217049402
217049409
21704...

output:

? 445223571 945223570
? 445223571 945223569
? 445223571 195223571
? 445223571 70223571
? 445223571 132723571
? 445223571 163973571
? 445223571 148348571
? 445223571 156161071
? 445223571 160067321
? 445223571 162020446
? 445223571 162997008
? 445223571 162508727
? 445223571 162264586
? 445223571 162...

result:

ok ok (1000 test cases)

Test #25:

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

input:

1000
999999999
377462224
377462223
249999936
252462224
189962224
218749936
203124936
195312436
191406186
189453061
188985662
188964779
188741522
188842708
188781673
188751155
188735896
188733893
188732081
188731986
188731127
188731510
188731272
188731153
188731093
188731097
188731082
188731086
18873...

output:

? 445223571 945223570
? 445223571 945223569
? 445223571 695223570
? 445223571 820223570
? 445223571 757723570
? 445223571 726473570
? 445223571 742098570
? 445223571 749911070
? 445223571 753817320
? 445223571 755770445
? 445223571 756747008
? 445223571 756258727
? 445223571 756502868
? 445223571 75...

result:

ok ok (1000 test cases)

Test #26:

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

input:

1000
999999999
374837988
374837989
250000000
374264884
312337988
343014884
327389884
319577384
315671134
313718009
312741446
312253165
312093848
312131094
312070059
312063331
312054800
312055702
312051887
312052892
312051938
312051461
312051649
312051530
312051471
312051441
312051446
312051438
31205...

output:

? 445223571 945223570
? 445223571 945223569
? 445223571 195223571
? 445223571 70223571
? 445223571 7723571
? 445223571 38973571
? 445223571 23348571
? 445223571 15536071
? 445223571 11629821
? 445223571 9676696
? 445223571 8700133
? 445223571 8211852
? 445223571 7967711
? 445223571 8089781
? 4452235...

result:

ok ok (1000 test cases)

Test #27:

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

input:

1000
536870912
108355805
108355806
134217728
145435449
111881017
95103801
99967197
95772893
93675741
94055225
93530937
93413597
93399865
93348061
93367097
93350713
93342521
93343965
93341917
93341497
93341405
93341241
93341277
93341213
93341209
93341197
93341201
93341197
93341195
93341196
186682389
...

output:

? 445223571 176788115
? 445223571 176788114
? 445223571 311005843
? 445223571 243896979
? 445223571 210342547
? 445223571 193565331
? 445223571 185176723
? 445223571 189371027
? 445223571 191468179
? 445223571 192516755
? 445223571 191992467
? 445223571 191730323
? 445223571 191861395
? 445223571 19...

result:

ok ok (1000 test cases)

Test #28:

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

input:

1000
536870911
244408484
244408483
110190756
43081892
9527460
13730550
5341942
5333156
3244790
4284580
3760292
3498148
3367076
3301540
3268772
3252388
3244196
3240694
3242148
3241124
3240612
3240438
3240484
3240420
3240406
3240404
3240398
3240400
3240398
3240397
1
1
536870911
213706771
213706770
134...

output:

? 445223571 176788115
? 445223571 176788114
? 445223571 42570387
? 445223571 512332434
? 445223571 478778002
? 445223571 462000786
? 445223571 470389394
? 445223571 474583698
? 445223571 472486546
? 445223571 473535122
? 445223571 473010834
? 445223571 472748690
? 445223571 472617618
? 445223571 472...

result:

ok ok (1000 test cases)

Extra Test:

score: 0
Extra Test Passed