QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#324754#8239. Mysterious Treeucup-team008#AC ✓4ms3940kbC++174.6kb2024-02-10 23:45:212024-02-10 23:45:21

Judging History

你现在查看的是最新测评结果

  • [2024-02-10 23:45:21]
  • 评测
  • 测评结果:AC
  • 用时:4ms
  • 内存:3940kb
  • [2024-02-10 23:45:21]
  • 提交

answer

#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <chrono>
#include <cmath>
#include <cstring>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <stack>
#include <unordered_set>
#include <vector>

using namespace std;

// BEGIN NO SAD
#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define trav(a, x) for(auto& a : x)
#define all(x) x.begin(), x.end()
#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define lb lower_bound
#define ub upper_bound
typedef vector<int> vi;
#define f first
#define s second
#define derr if(1) cerr

void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}
 
template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ", "; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? ", " : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#define debug(x...) cerr << "\e[91m"<<__func__<<":"<<__LINE__<<" [" << #x << "] = ["; _print(x); cerr << "\e[39m" << flush;
// END NO SAD

template<class Fun>
class y_combinator_result {
  Fun fun_;
public:
  template<class T>
  explicit y_combinator_result(T &&fun): fun_(std::forward<T>(fun)) {}

  template<class ...Args>
  decltype(auto) operator()(Args &&...args) {
    return fun_(std::ref(*this), std::forward<Args>(args)...);
  }
};

template<class Fun>
decltype(auto) y_combinator(Fun &&fun) {
  return y_combinator_result<std::decay_t<Fun>>(std::forward<Fun>(fun));
}

template<class T>
bool updmin(T& a, T b) {
  if(b < a) {
    a = b;
    return true;
  }
  return false;
}
template<class T>
bool updmax(T& a, T b) {
  if(b > a) {
    a = b;
    return true;
  }
  return false;
}
typedef int64_t ll;

// check 1-2, 3-4, 5-6, ..., n-1, n
void rsolve() {
  int n;
  cin >> n;
  vector<array<int, 2>> v;
  if(n%2 == 0) {
    for(int i = 1; i <= n; i += 2) v.pb({i, i+1});
  }
  else {
    for(int i = 1; i < n; i += 2) v.pb({i, i+1});
    v.pb({n, 1});
  }
  map<int, int> deg;
  set<array<int, 2>> valid;
  map<int, set<int>> seen;
  auto qry = [&](int x, int y) -> int {
    if(seen[x].count(y)) return valid.count({x, y});
    assert(!seen[x].count(y));
    assert(!seen[y].count(x));
    seen[x].insert(y);
    seen[y].insert(x);
    cout << "? " << x << " " << y << endl;
    int ret;
    cin >> ret;
    deg[x] += ret;
    deg[y] += ret;
    if(ret) {
      valid.insert({x, y});
      valid.insert({y, x});
    }
    return ret;
  };
  array<int, 2> init = {-1, -1};
  for(auto [x, y]: v) {
    int ret = qry(x, y);
    if(ret == 1) {
      init = {x, y};
      break;
    }
  }
  if(init[0] == -1) {
    cout << "! 1" << endl;
    return;
  }
  int x = 1 + rand()%n;
  while(x == init[0] || x == init[1]) {
    x = 1 + rand()%n;
  }
  assert(x != init[0] && x != init[1]);
  if(qry(init[0], x)) {
    // init[0] is deg 2
    assert(deg[init[0]] == 2);
    int cand = 1;
    while(seen[init[0]].count(cand) || cand == init[0]) cand++;
    if(qry(init[0], cand)) {
      cout << "! 2" << endl;
      return;
    }
    else {
      cout << "! 1" << endl;
      return;
    }
    assert(false);
  }
  else {
    if(qry(init[1], x)) {
      int cand = 1;
      while(seen[init[1]].count(cand) || cand == init[1]) cand++;
      if(qry(init[1], cand)) {
        cout << "! 2" << endl;
        return;
      }
      else {
        cout << "! 1" << endl;
        return;
      }
    }
    else {
      cout << "! 1" << endl;
      return;
    }
    assert(false);
  }
  assert(false);
}
void solve() {
  int t;
  cin >> t;
  while(t--) rsolve();  
}

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  solve();
}

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

詳細信息

Test #1:

score: 100
Accepted
time: 1ms
memory: 3608kb

input:

2
4
1
0
0
4
0
1
1
1

output:

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

result:

ok Correct (2 test cases)

Test #2:

score: 0
Accepted
time: 4ms
memory: 3780kb

input:

87
13
0
0
0
0
0
1
0
1
1
15
0
0
0
0
0
0
1
1
1
7
0
0
0
1
1
1
15
0
0
0
1
0
0
19
0
0
0
0
0
1
1
1
20
0
0
0
0
0
0
0
0
0
0
7
0
0
1
0
1
1
20
0
0
0
0
0
0
0
1
1
1
17
0
0
0
0
0
0
0
0
0
11
1
0
1
0
14
0
0
0
0
0
0
0
13
0
0
0
0
0
0
0
18
0
0
0
0
0
1
0
1
1
14
0
1
0
1
1
20
0
0
0
0
1
0
0
11
0
0
0
1
0
0
11
0
1
0
0
8
0
...

output:

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

result:

ok Correct (87 test cases)

Test #3:

score: 0
Accepted
time: 3ms
memory: 3616kb

input:

135
9
1
0
1
0
6
0
0
0
11
0
0
0
0
1
0
0
4
1
0
0
10
0
0
0
0
1
1
1
9
0
0
0
1
1
1
9
0
0
1
0
1
1
6
0
0
0
9
0
0
0
1
1
1
11
0
0
0
0
1
0
0
4
0
0
4
1
1
1
8
0
0
0
0
5
0
0
0
7
1
0
0
11
0
0
0
0
1
0
1
1
4
1
1
1
6
1
1
1
9
0
0
1
1
1
4
1
0
1
1
8
1
0
0
9
0
0
1
0
1
1
7
0
0
1
0
0
4
1
1
1
8
0
0
0
0
11
0
0
0
0
1
1
1
8
0...

output:

? 1 2
? 1 8
? 2 8
? 2 3
! 1
? 1 2
? 3 4
? 5 6
! 1
? 1 2
? 3 4
? 5 6
? 7 8
? 9 10
? 9 7
? 10 7
! 1
? 1 2
? 1 4
? 2 4
! 1
? 1 2
? 3 4
? 5 6
? 7 8
? 9 10
? 9 4
? 9 1
! 2
? 1 2
? 3 4
? 5 6
? 7 8
? 7 2
? 7 1
! 2
? 1 2
? 3 4
? 5 6
? 5 4
? 6 4
? 6 1
! 2
? 1 2
? 3 4
? 5 6
! 1
? 1 2
? 3 4
? 5 6
? 7 8
? 7 2
?...

result:

ok Correct (135 test cases)

Test #4:

score: 0
Accepted
time: 0ms
memory: 3772kb

input:

136
8
0
0
0
1
0
1
1
5
1
0
1
1
11
0
0
1
0
0
10
1
0
0
6
0
0
0
9
0
0
1
0
1
1
7
0
1
1
1
10
0
0
1
0
1
1
7
0
0
1
1
1
9
0
0
1
1
1
5
0
0
1
1
1
7
0
0
0
1
0
0
10
0
0
1
0
1
1
6
0
1
0
0
6
0
0
1
0
0
6
0
1
0
1
1
10
0
1
1
1
9
0
0
1
1
1
5
0
1
1
1
6
0
0
1
1
1
4
0
0
5
0
1
1
1
4
1
0
1
1
7
0
0
0
1
1
1
10
0
0
0
1
1
1
8
...

output:

? 1 2
? 3 4
? 5 6
? 7 8
? 7 2
? 8 2
? 8 1
! 2
? 1 2
? 1 4
? 2 4
? 2 3
! 2
? 1 2
? 3 4
? 5 6
? 5 1
? 6 1
! 1
? 1 2
? 1 3
? 2 3
! 1
? 1 2
? 3 4
? 5 6
! 1
? 1 2
? 3 4
? 5 6
? 5 7
? 6 7
? 6 1
! 2
? 1 2
? 3 4
? 3 6
? 3 1
! 2
? 1 2
? 3 4
? 5 6
? 5 1
? 6 1
? 6 2
! 2
? 1 2
? 3 4
? 5 6
? 5 7
? 5 1
! 2
? 1 2
...

result:

ok Correct (136 test cases)

Test #5:

score: 0
Accepted
time: 1ms
memory: 3632kb

input:

5
100
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
758
0
0
0
0
0
0
0
0
0
1
0
1
1
70
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
65
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
5
0
0
1
1
1

output:

? 1 2
? 3 4
? 5 6
? 7 8
? 9 10
? 11 12
? 13 14
? 15 16
? 17 18
? 19 20
? 21 22
? 23 24
? 25 26
? 27 28
? 29 30
? 31 32
? 33 34
? 35 36
? 37 38
? 39 40
? 41 42
? 43 44
? 45 46
? 47 48
? 49 50
? 51 52
? 53 54
? 55 56
? 57 58
? 59 60
? 61 62
? 63 64
? 65 66
? 67 68
? 69 70
? 71 72
? 73 74
? 75 76
? 77 ...

result:

ok Correct (5 test cases)

Test #6:

score: 0
Accepted
time: 0ms
memory: 3804kb

input:

7
147
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
801
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
27
0
0
0
0
0
0
0
0...

output:

? 1 2
? 3 4
? 5 6
? 7 8
? 9 10
? 11 12
? 13 14
? 15 16
? 17 18
? 19 20
? 21 22
? 23 24
? 25 26
? 27 28
? 29 30
? 31 32
? 33 34
? 35 36
? 37 38
? 39 40
? 41 42
? 43 44
? 45 46
? 47 48
? 49 50
? 51 52
? 53 54
? 55 56
? 57 58
? 59 60
? 61 62
? 63 64
? 65 66
? 67 68
? 69 70
? 71 72
? 73 74
? 75 76
? 77 ...

result:

ok Correct (7 test cases)

Test #7:

score: 0
Accepted
time: 4ms
memory: 3828kb

input:

160
4
0
0
9
0
0
0
0
0
7
0
0
0
1
1
1
4
0
0
9
0
0
0
0
1
1
1
9
0
0
0
0
1
1
1
6
0
0
1
0
1
1
7
0
0
0
1
1
1
4
0
0
6
0
0
1
0
1
1
4
0
0
5
0
0
1
1
1
7
0
0
0
1
1
1
4
0
1
0
1
1
7
0
0
0
0
6
0
0
0
9
0
0
0
0
0
9
0
0
0
0
0
4
0
0
4
0
0
4
0
0
5
0
0
1
1
1
9
0
0
0
0
0
6
0
0
0
9
0
0
0
0
0
5
0
0
1
1
1
6
0
0
0
5
0
0
0
9
...

output:

? 1 2
? 3 4
! 1
? 1 2
? 3 4
? 5 6
? 7 8
? 9 1
! 1
? 1 2
? 3 4
? 5 6
? 7 1
? 7 2
? 7 3
! 2
? 1 2
? 3 4
! 1
? 1 2
? 3 4
? 5 6
? 7 8
? 9 1
? 9 8
? 9 2
! 2
? 1 2
? 3 4
? 5 6
? 7 8
? 9 1
? 9 8
? 9 2
! 2
? 1 2
? 3 4
? 5 6
? 5 2
? 6 2
? 6 1
! 2
? 1 2
? 3 4
? 5 6
? 7 1
? 7 4
? 7 2
! 2
? 1 2
? 3 4
! 1
? 1 2
...

result:

ok Correct (160 test cases)

Test #8:

score: 0
Accepted
time: 3ms
memory: 3640kb

input:

117
6
0
0
0
7
0
0
0
0
11
0
0
0
0
0
1
1
1
4
0
0
11
0
0
0
0
0
0
5
0
0
1
1
1
10
0
0
0
0
0
9
0
0
0
0
1
1
1
10
0
0
0
0
1
0
1
1
11
0
0
0
0
0
0
9
0
0
0
0
0
13
0
0
0
0
0
0
0
11
0
0
0
0
0
0
13
0
0
0
0
0
0
0
8
0
0
0
1
0
1
1
13
0
0
0
0
0
0
0
11
0
0
0
0
0
1
1
1
11
0
0
0
0
0
0
11
0
0
0
0
0
0
8
0
0
0
0
6
0
0
0
9
...

output:

? 1 2
? 3 4
? 5 6
! 1
? 1 2
? 3 4
? 5 6
? 7 1
! 1
? 1 2
? 3 4
? 5 6
? 7 8
? 9 10
? 11 1
? 11 7
? 11 2
! 2
? 1 2
? 3 4
! 1
? 1 2
? 3 4
? 5 6
? 7 8
? 9 10
? 11 1
! 1
? 1 2
? 3 4
? 5 1
? 5 2
? 5 3
! 2
? 1 2
? 3 4
? 5 6
? 7 8
? 9 10
! 1
? 1 2
? 3 4
? 5 6
? 7 8
? 9 1
? 9 8
? 9 2
! 2
? 1 2
? 3 4
? 5 6
? 7...

result:

ok Correct (117 test cases)

Test #9:

score: 0
Accepted
time: 4ms
memory: 3820kb

input:

99
14
0
0
0
0
0
0
1
0
1
1
6
0
0
1
0
1
1
13
0
0
0
0
0
0
0
4
0
0
14
0
0
0
0
0
0
0
11
0
0
0
0
0
0
11
0
0
0
0
0
0
11
0
0
0
0
0
1
1
1
15
0
0
0
0
0
0
0
1
1
1
4
0
0
12
0
0
0
0
0
0
14
0
0
0
0
0
0
1
0
1
1
13
0
0
0
0
0
0
1
1
1
9
0
0
0
0
1
1
1
8
0
0
0
0
7
0
0
0
0
7
0
0
0
1
1
1
4
0
0
8
0
0
0
1
0
1
1
10
0
0
0
0
...

output:

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

result:

ok Correct (99 test cases)

Test #10:

score: 0
Accepted
time: 0ms
memory: 3632kb

input:

84
18
0
0
0
0
0
0
0
0
0
14
0
0
0
0
0
0
0
17
0
0
0
0
0
0
0
0
1
1
1
13
0
0
0
0
0
0
0
11
0
0
0
0
0
1
1
1
7
0
0
0
0
14
0
0
0
0
0
0
0
12
0
0
0
0
0
0
17
0
0
0
0
0
0
0
0
1
1
1
6
0
0
0
9
0
0
0
0
0
10
0
0
0
0
1
0
1
1
5
0
0
1
1
1
4
0
0
6
0
0
0
15
0
0
0
0
0
0
0
0
4
0
0
17
0
0
0
0
0
0
0
0
1
1
1
12
0
0
0
0
0
0
1...

output:

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

result:

ok Correct (84 test cases)

Test #11:

score: 0
Accepted
time: 0ms
memory: 3564kb

input:

23
27
0
0
0
0
0
0
0
0
0
0
0
0
0
1
1
1
12
0
0
0
0
0
0
93
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
100
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
1
1
6
0
0
0
59
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0...

output:

? 1 2
? 3 4
? 5 6
? 7 8
? 9 10
? 11 12
? 13 14
? 15 16
? 17 18
? 19 20
? 21 22
? 23 24
? 25 26
? 27 1
? 27 20
? 27 2
! 2
? 1 2
? 3 4
? 5 6
? 7 8
? 9 10
? 11 12
! 1
? 1 2
? 3 4
? 5 6
? 7 8
? 9 10
? 11 12
? 13 14
? 15 16
? 17 18
? 19 20
? 21 22
? 23 24
? 25 26
? 27 28
? 29 30
? 31 32
? 33 34
? 35 36
?...

result:

ok Correct (23 test cases)

Test #12:

score: 0
Accepted
time: 0ms
memory: 3824kb

input:

20
39
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
1
1
44
0
0
0
0
0
0
0
0
0
0
0
0
1
0
1
1
85
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
1
1
35
0
0
0
0
0
0
0
0
0
1
0
1
1
94
0
0
0
0
0
0
0
0
0
1
0
0
92
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0...

output:

? 1 2
? 3 4
? 5 6
? 7 8
? 9 10
? 11 12
? 13 14
? 15 16
? 17 18
? 19 20
? 21 22
? 23 24
? 25 26
? 27 28
? 29 30
? 31 32
? 33 34
? 35 36
? 37 38
? 37 14
? 37 1
! 2
? 1 2
? 3 4
? 5 6
? 7 8
? 9 10
? 11 12
? 13 14
? 15 16
? 17 18
? 19 20
? 21 22
? 23 24
? 25 26
? 25 11
? 26 11
? 26 1
! 2
? 1 2
? 3 4
? 5 ...

result:

ok Correct (20 test cases)

Test #13:

score: 0
Accepted
time: 1ms
memory: 3804kb

input:

9
69
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
189
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
1
1
72
0
0
0
0
0
0
0
0
0
0
0
0
...

output:

? 1 2
? 3 4
? 5 6
? 7 8
? 9 10
? 11 12
? 13 14
? 15 16
? 17 18
? 19 20
? 21 22
? 23 24
? 25 26
? 27 28
? 29 30
? 31 32
? 33 34
? 35 36
? 37 38
? 39 40
? 41 42
? 43 44
? 45 46
? 47 48
? 49 50
? 51 52
? 53 54
? 55 56
? 57 58
? 59 60
? 61 62
? 63 64
? 65 66
? 67 68
? 69 1
! 1
? 1 2
? 3 4
? 5 6
? 7 8
? ...

result:

ok Correct (9 test cases)

Test #14:

score: 0
Accepted
time: 4ms
memory: 3880kb

input:

6
243
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
181
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
...

output:

? 1 2
? 3 4
? 5 6
? 7 8
? 9 10
? 11 12
? 13 14
? 15 16
? 17 18
? 19 20
? 21 22
? 23 24
? 25 26
? 27 28
? 29 30
? 31 32
? 33 34
? 35 36
? 37 38
? 39 40
? 41 42
? 43 44
? 45 46
? 47 48
? 49 50
? 51 52
? 53 54
? 55 56
? 57 58
? 59 60
? 61 62
? 63 64
? 65 66
? 67 68
? 69 70
? 71 72
? 73 74
? 75 76
? 77 ...

result:

ok Correct (6 test cases)

Test #15:

score: 0
Accepted
time: 0ms
memory: 3716kb

input:

4
613
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
...

output:

? 1 2
? 3 4
? 5 6
? 7 8
? 9 10
? 11 12
? 13 14
? 15 16
? 17 18
? 19 20
? 21 22
? 23 24
? 25 26
? 27 28
? 29 30
? 31 32
? 33 34
? 35 36
? 37 38
? 39 40
? 41 42
? 43 44
? 45 46
? 47 48
? 49 50
? 51 52
? 53 54
? 55 56
? 57 58
? 59 60
? 61 62
? 63 64
? 65 66
? 67 68
? 69 70
? 71 72
? 73 74
? 75 76
? 77 ...

result:

ok Correct (4 test cases)

Test #16:

score: 0
Accepted
time: 0ms
memory: 3808kb

input:

146
6
1
1
0
9
1
1
0
4
1
1
1
9
1
1
1
7
1
1
0
6
1
1
1
5
1
1
0
9
1
1
1
7
1
1
0
4
1
1
1
9
1
1
1
5
1
1
1
4
1
1
1
9
1
1
1
5
1
1
0
4
1
1
1
9
1
1
0
6
1
1
1
5
1
1
0
9
1
1
1
6
1
1
1
5
1
1
0
7
1
1
0
5
1
1
1
5
1
1
1
5
1
1
1
7
1
1
1
4
1
1
0
4
1
1
1
6
1
1
0
8
1
1
0
7
1
1
0
5
1
1
0
9
1
1
0
7
1
1
1
8
1
1
0
6
1
1
1
...

output:

? 1 2
? 1 5
? 1 3
! 1
? 1 2
? 1 8
? 1 3
! 1
? 1 2
? 1 4
? 1 3
! 2
? 1 2
? 1 4
? 1 3
! 2
? 1 2
? 1 4
? 1 3
! 1
? 1 2
? 1 3
? 1 4
! 2
? 1 2
? 1 3
? 1 4
! 1
? 1 2
? 1 6
? 1 3
! 2
? 1 2
? 1 5
? 1 3
! 1
? 1 2
? 1 4
? 1 3
! 2
? 1 2
? 1 5
? 1 3
! 2
? 1 2
? 1 3
? 1 4
! 2
? 1 2
? 1 4
? 1 3
! 2
? 1 2
? 1 9
? ...

result:

ok Correct (146 test cases)

Test #17:

score: 0
Accepted
time: 4ms
memory: 3776kb

input:

117
4
1
1
1
4
1
1
1
12
1
1
1
7
1
1
1
12
1
1
1
9
1
1
1
10
1
1
1
13
1
1
1
11
1
1
1
9
1
1
0
12
1
1
1
11
1
1
0
4
1
1
0
10
1
1
1
5
1
1
1
5
1
1
1
5
1
1
1
4
1
1
0
4
1
1
1
7
1
1
0
4
1
1
1
8
1
1
1
7
1
1
0
6
1
1
1
7
1
1
0
13
1
1
1
10
1
1
1
12
1
1
1
9
1
1
1
4
1
1
1
9
1
1
0
7
1
1
1
6
1
1
1
11
1
1
1
8
1
1
0
13
1...

output:

? 1 2
? 1 4
? 1 3
! 2
? 1 2
? 1 3
? 1 4
! 2
? 1 2
? 1 10
? 1 3
! 2
? 1 2
? 1 6
? 1 3
! 2
? 1 2
? 1 6
? 1 3
! 2
? 1 2
? 1 8
? 1 3
! 2
? 1 2
? 1 7
? 1 3
! 2
? 1 2
? 1 4
? 1 3
! 2
? 1 2
? 1 4
? 1 3
! 2
? 1 2
? 1 6
? 1 3
! 1
? 1 2
? 1 8
? 1 3
! 2
? 1 2
? 1 6
? 1 3
! 1
? 1 2
? 1 4
? 1 3
! 1
? 1 2
? 1 4
?...

result:

ok Correct (117 test cases)

Test #18:

score: 0
Accepted
time: 3ms
memory: 3608kb

input:

105
7
1
1
0
11
1
1
1
13
1
1
0
12
1
1
1
6
1
1
1
10
1
1
1
7
1
1
0
4
1
1
0
13
1
1
1
13
1
1
1
14
1
1
0
5
1
1
1
6
1
1
1
4
1
1
1
6
1
1
1
6
1
1
0
10
1
1
1
15
1
1
1
6
1
1
0
9
1
1
0
13
1
1
0
15
1
1
1
5
1
1
1
11
1
1
0
6
1
1
0
7
1
1
1
10
1
1
0
15
1
1
1
12
1
1
0
7
1
1
1
12
1
1
0
12
1
1
1
6
1
1
1
4
1
1
1
6
1
1
1...

output:

? 1 2
? 1 5
? 1 3
! 1
? 1 2
? 1 7
? 1 3
! 2
? 1 2
? 1 5
? 1 3
! 1
? 1 2
? 1 6
? 1 3
! 2
? 1 2
? 1 5
? 1 3
! 2
? 1 2
? 1 3
? 1 4
! 2
? 1 2
? 1 4
? 1 3
! 1
? 1 2
? 1 3
? 1 4
! 1
? 1 2
? 1 4
? 1 3
! 2
? 1 2
? 1 5
? 1 3
! 2
? 1 2
? 1 14
? 1 3
! 1
? 1 2
? 1 3
? 1 4
! 2
? 1 2
? 1 5
? 1 3
! 2
? 1 2
? 1 4
?...

result:

ok Correct (105 test cases)

Test #19:

score: 0
Accepted
time: 0ms
memory: 3600kb

input:

86
12
1
1
1
17
1
1
1
7
1
1
1
6
1
1
0
13
1
1
1
5
1
1
1
16
1
1
0
6
1
1
1
10
1
1
0
18
1
1
1
4
1
1
1
19
1
1
1
14
1
1
1
13
1
1
1
4
1
1
1
5
1
1
0
8
1
1
1
13
1
1
0
15
1
1
1
7
1
1
0
20
1
1
0
20
1
1
0
5
1
1
1
6
1
1
0
5
1
1
0
15
1
1
0
12
1
1
1
9
1
1
1
17
1
1
0
19
1
1
1
20
1
1
1
11
1
1
0
20
1
1
0
14
1
1
1
18
1...

output:

? 1 2
? 1 8
? 1 3
! 2
? 1 2
? 1 16
? 1 3
! 2
? 1 2
? 1 3
? 1 4
! 2
? 1 2
? 1 6
? 1 3
! 1
? 1 2
? 1 13
? 1 3
! 2
? 1 2
? 1 3
? 1 4
! 2
? 1 2
? 1 10
? 1 3
! 1
? 1 2
? 1 3
? 1 4
! 2
? 1 2
? 1 8
? 1 3
! 1
? 1 2
? 1 15
? 1 3
! 2
? 1 2
? 1 4
? 1 3
! 2
? 1 2
? 1 11
? 1 3
! 2
? 1 2
? 1 11
? 1 3
! 2
? 1 2
? ...

result:

ok Correct (86 test cases)

Test #20:

score: 0
Accepted
time: 1ms
memory: 3812kb

input:

20
53
1
1
0
61
1
1
1
96
1
1
1
60
1
1
1
25
1
1
1
18
1
1
1
24
1
1
1
73
1
1
1
76
1
1
0
62
1
1
0
33
1
1
1
89
1
1
0
55
1
1
0
71
1
1
0
45
1
1
1
44
1
1
1
52
1
1
1
46
1
1
0
7
1
1
0
7
1
1
1

output:

? 1 2
? 1 49
? 1 3
! 1
? 1 2
? 1 55
? 1 3
! 2
? 1 2
? 1 10
? 1 3
! 2
? 1 2
? 1 56
? 1 3
! 2
? 1 2
? 1 19
? 1 3
! 2
? 1 2
? 1 8
? 1 3
! 2
? 1 2
? 1 11
? 1 3
! 2
? 1 2
? 1 59
? 1 3
! 2
? 1 2
? 1 22
? 1 3
! 1
? 1 2
? 1 54
? 1 3
! 1
? 1 2
? 1 9
? 1 3
! 2
? 1 2
? 1 23
? 1 3
! 1
? 1 2
? 1 6
? 1 3
! 1
? 1 ...

result:

ok Correct (20 test cases)

Test #21:

score: 0
Accepted
time: 1ms
memory: 3780kb

input:

9
273
1
1
0
54
1
1
0
234
1
1
1
256
1
1
1
70
1
1
1
23
1
1
0
5
1
1
0
81
1
1
1
4
1
1
1

output:

? 1 2
? 1 170
? 1 3
! 1
? 1 2
? 1 17
? 1 3
! 1
? 1 2
? 1 64
? 1 3
! 2
? 1 2
? 1 116
? 1 3
! 2
? 1 2
? 1 44
? 1 3
! 2
? 1 2
? 1 15
? 1 3
! 1
? 1 2
? 1 3
? 1 4
! 1
? 1 2
? 1 7
? 1 3
! 2
? 1 2
? 1 3
? 1 4
! 2

result:

ok Correct (9 test cases)

Test #22:

score: 0
Accepted
time: 1ms
memory: 3552kb

input:

12
92
1
1
1
50
1
1
1
395
1
1
0
152
1
1
1
31
1
1
1
183
1
1
1
13
1
1
1
32
1
1
1
21
1
1
0
12
1
1
0
14
1
1
0
4
1
1
1

output:

? 1 2
? 1 12
? 1 3
! 2
? 1 2
? 1 37
? 1 3
! 2
? 1 2
? 1 28
? 1 3
! 1
? 1 2
? 1 4
? 1 3
! 2
? 1 2
? 1 20
? 1 3
! 2
? 1 2
? 1 50
? 1 3
! 2
? 1 2
? 1 13
? 1 3
! 2
? 1 2
? 1 13
? 1 3
! 2
? 1 2
? 1 16
? 1 3
! 1
? 1 2
? 1 3
? 1 4
! 1
? 1 2
? 1 6
? 1 3
! 1
? 1 2
? 1 3
? 1 4
! 2

result:

ok Correct (12 test cases)

Test #23:

score: 0
Accepted
time: 1ms
memory: 3764kb

input:

5
957
1
1
0
14
1
1
0
7
1
1
1
10
1
1
1
11
1
1
0

output:

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

result:

ok Correct (5 test cases)

Test #24:

score: 0
Accepted
time: 4ms
memory: 3540kb

input:

81
11
1
1
0
20
1
1
1
5
1
0
1
1
16
0
0
0
0
0
0
1
0
0
19
0
1
1
1
17
1
0
1
1
12
1
1
1
4
1
1
1
13
0
0
1
0
1
0
20
0
0
1
0
1
1
10
1
0
1
1
20
1
1
0
8
1
1
1
5
0
0
0
11
1
1
0
17
0
1
1
1
9
1
1
0
13
0
1
1
1
19
0
1
0
1
1
13
0
0
1
0
0
17
0
0
0
0
0
0
0
0
1
1
1
18
1
1
1
12
1
0
0
19
1
1
1
18
0
0
0
0
0
0
0
0
0
8
1
1...

output:

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

result:

ok Correct (81 test cases)

Test #25:

score: 0
Accepted
time: 1ms
memory: 3780kb

input:

24
43
1
1
1
87
1
1
1
19
0
1
1
1
23
0
0
0
1
0
0
13
0
1
1
0
75
1
1
0
13
0
1
0
1
1
85
1
0
1
1
31
1
1
1
24
1
0
1
1
68
1
1
0
94
1
1
1
11
0
0
0
0
0
0
33
1
1
1
80
0
0
0
0
1
0
1
1
85
1
0
1
1
74
0
0
1
0
1
0
42
1
0
1
0
65
0
0
0
0
0
1
0
1
1
13
0
0
0
0
0
0
1
0
0
5
1
1
0
7
0
0
0
1
1
1
4
1
0
1
1
5
0
0
1
1
1

output:

? 1 2
? 1 10
? 1 3
! 2
? 1 2
? 1 68
? 1 3
! 2
? 1 2
? 3 4
? 3 11
? 3 1
! 2
? 1 2
? 3 4
? 5 6
? 7 8
? 7 1
? 8 1
! 1
? 1 2
? 3 4
? 3 13
? 3 1
! 1
? 1 2
? 1 43
? 1 3
! 1
? 1 2
? 3 4
? 3 2
? 4 2
? 4 1
! 2
? 1 2
? 1 37
? 2 37
? 2 3
! 2
? 1 2
? 1 30
? 1 3
! 2
? 1 2
? 1 20
? 2 20
? 2 3
! 2
? 1 2
? 1 55
? 1...

result:

ok Correct (24 test cases)

Test #26:

score: 0
Accepted
time: 1ms
memory: 3512kb

input:

9
35
0
0
0
0
1
0
0
122
1
1
1
167
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
288
0
1
1
1
173
1
0
1
0
45
1
1
1
99
0
0
1
0
1
1
64
0
0
0
0
0
0
0
0
0
1
0
1
1
5
0
0
0

output:

? 1 2
? 3 4
? 5 6
? 7 8
? 9 10
? 9 12
? 10 12
! 1
? 1 2
? 1 4
? 1 3
! 2
? 1 2
? 3 4
? 5 6
? 7 8
? 9 10
? 11 12
? 13 14
? 15 16
? 17 18
? 19 20
? 21 22
? 23 24
? 25 26
? 27 28
? 29 30
? 31 32
? 33 34
? 35 36
? 37 38
? 39 40
? 41 42
? 43 44
? 45 46
? 47 48
? 49 50
? 51 52
? 51 154
? 52 154
! 1
? 1 2
?...

result:

ok Correct (9 test cases)

Test #27:

score: 0
Accepted
time: 0ms
memory: 3816kb

input:

8
481
0
0
0
0
1
0
1
1
165
0
0
0
0
1
0
1
1
11
0
0
1
0
0
145
0
1
1
0
34
1
0
0
148
1
1
1
12
1
1
0
4
0
1
1
1

output:

? 1 2
? 3 4
? 5 6
? 7 8
? 9 10
? 9 183
? 10 183
? 10 1
! 2
? 1 2
? 3 4
? 5 6
? 7 8
? 9 10
? 9 77
? 10 77
? 10 1
! 2
? 1 2
? 3 4
? 5 6
? 5 7
? 6 7
! 1
? 1 2
? 3 4
? 3 26
? 3 1
! 1
? 1 2
? 1 16
? 2 16
! 1
? 1 2
? 1 36
? 1 3
! 2
? 1 2
? 1 11
? 1 3
! 1
? 1 2
? 3 4
? 3 1
? 3 2
! 2

result:

ok Correct (8 test cases)

Test #28:

score: 0
Accepted
time: 1ms
memory: 3548kb

input:

10
510
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
222
1
1
0
115
1
1
0
20
1
1
1
37
1
1
1
10
0
1
0
0
19
1
1
1
22
0
1
0
0
36
1
1
1
7
0
0
0
1
1
0

output:

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

result:

ok Correct (10 test cases)

Test #29:

score: 0
Accepted
time: 3ms
memory: 3940kb

input:

1
1000
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0...

output:

? 1 2
? 3 4
? 5 6
? 7 8
? 9 10
? 11 12
? 13 14
? 15 16
? 17 18
? 19 20
? 21 22
? 23 24
? 25 26
? 27 28
? 29 30
? 31 32
? 33 34
? 35 36
? 37 38
? 39 40
? 41 42
? 43 44
? 45 46
? 47 48
? 49 50
? 51 52
? 53 54
? 55 56
? 57 58
? 59 60
? 61 62
? 63 64
? 65 66
? 67 68
? 69 70
? 71 72
? 73 74
? 75 76
? 77 ...

result:

ok Correct (1 test case)

Test #30:

score: 0
Accepted
time: 0ms
memory: 3852kb

input:

2
500
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
...

output:

? 1 2
? 3 4
? 5 6
? 7 8
? 9 10
? 11 12
? 13 14
? 15 16
? 17 18
? 19 20
? 21 22
? 23 24
? 25 26
? 27 28
? 29 30
? 31 32
? 33 34
? 35 36
? 37 38
? 39 40
? 41 42
? 43 44
? 45 46
? 47 48
? 49 50
? 51 52
? 53 54
? 55 56
? 57 58
? 59 60
? 61 62
? 63 64
? 65 66
? 67 68
? 69 70
? 71 72
? 73 74
? 75 76
? 77 ...

result:

ok Correct (2 test cases)

Test #31:

score: 0
Accepted
time: 1ms
memory: 3824kb

input:

4
250
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
1
1
250
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
...

output:

? 1 2
? 3 4
? 5 6
? 7 8
? 9 10
? 11 12
? 13 14
? 15 16
? 17 18
? 19 20
? 21 22
? 23 24
? 25 26
? 27 28
? 29 30
? 31 32
? 33 34
? 35 36
? 37 38
? 39 40
? 41 42
? 43 44
? 45 46
? 47 48
? 49 50
? 51 52
? 53 54
? 55 56
? 57 58
? 59 60
? 61 62
? 63 64
? 65 66
? 67 68
? 69 70
? 71 72
? 73 74
? 75 76
? 75 ...

result:

ok Correct (4 test cases)

Test #32:

score: 0
Accepted
time: 3ms
memory: 3720kb

input:

1
1000
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0...

output:

? 1 2
? 3 4
? 5 6
? 7 8
? 9 10
? 11 12
? 13 14
? 15 16
? 17 18
? 19 20
? 21 22
? 23 24
? 25 26
? 27 28
? 29 30
? 31 32
? 33 34
? 35 36
? 37 38
? 39 40
? 41 42
? 43 44
? 45 46
? 47 48
? 49 50
? 51 52
? 53 54
? 55 56
? 57 58
? 59 60
? 61 62
? 63 64
? 65 66
? 67 68
? 69 70
? 71 72
? 73 74
? 75 76
? 77 ...

result:

ok Correct (1 test case)

Test #33:

score: 0
Accepted
time: 1ms
memory: 3756kb

input:

1
1000
1
1
1

output:

? 1 2
? 1 384
? 1 3
! 2

result:

ok Correct (1 test case)

Test #34:

score: 0
Accepted
time: 1ms
memory: 3632kb

input:

1
1000
0
0
0
0
1
0
1
1

output:

? 1 2
? 3 4
? 5 6
? 7 8
? 9 10
? 9 384
? 10 384
? 10 1
! 2

result:

ok Correct (1 test case)

Test #35:

score: 0
Accepted
time: 1ms
memory: 3920kb

input:

2
500
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
...

output:

? 1 2
? 3 4
? 5 6
? 7 8
? 9 10
? 11 12
? 13 14
? 15 16
? 17 18
? 19 20
? 21 22
? 23 24
? 25 26
? 27 28
? 29 30
? 31 32
? 33 34
? 35 36
? 37 38
? 39 40
? 41 42
? 43 44
? 45 46
? 47 48
? 49 50
? 51 52
? 53 54
? 55 56
? 57 58
? 59 60
? 61 62
? 63 64
? 65 66
? 67 68
? 69 70
? 71 72
? 73 74
? 75 76
? 77 ...

result:

ok Correct (2 test cases)

Test #36:

score: 0
Accepted
time: 1ms
memory: 3756kb

input:

2
500
1
1
1
500
1
1
0

output:

? 1 2
? 1 384
? 1 3
! 2
? 1 2
? 1 387
? 1 3
! 1

result:

ok Correct (2 test cases)

Test #37:

score: 0
Accepted
time: 0ms
memory: 3832kb

input:

2
500
1
1
1
500
0
1
0
1
1

output:

? 1 2
? 1 384
? 1 3
! 2
? 1 2
? 3 4
? 3 387
? 4 387
? 4 1
! 2

result:

ok Correct (2 test cases)

Test #38:

score: 0
Accepted
time: 0ms
memory: 3548kb

input:

4
250
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
1
1
250
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
...

output:

? 1 2
? 3 4
? 5 6
? 7 8
? 9 10
? 11 12
? 13 14
? 15 16
? 17 18
? 19 20
? 21 22
? 23 24
? 25 26
? 27 28
? 29 30
? 31 32
? 33 34
? 35 36
? 37 38
? 39 40
? 41 42
? 43 44
? 45 46
? 47 48
? 49 50
? 51 52
? 53 54
? 55 56
? 57 58
? 59 60
? 61 62
? 63 64
? 65 66
? 67 68
? 69 70
? 71 72
? 73 74
? 75 76
? 77 ...

result:

ok Correct (4 test cases)

Test #39:

score: 0
Accepted
time: 1ms
memory: 3536kb

input:

4
250
1
1
0
250
1
1
0
250
1
1
1
250
1
1
0

output:

? 1 2
? 1 134
? 1 3
! 1
? 1 2
? 1 137
? 1 3
! 1
? 1 2
? 1 28
? 1 3
! 2
? 1 2
? 1 166
? 1 3
! 1

result:

ok Correct (4 test cases)

Test #40:

score: 0
Accepted
time: 1ms
memory: 3616kb

input:

4
250
0
0
0
0
1
0
1
1
250
0
0
0
0
1
0
1
1
250
0
0
1
1
0
250
0
0
1
0
1
1

output:

? 1 2
? 3 4
? 5 6
? 7 8
? 9 10
? 9 134
? 10 134
? 10 1
! 2
? 1 2
? 3 4
? 5 6
? 7 8
? 9 10
? 9 137
? 10 137
? 10 1
! 2
? 1 2
? 3 4
? 5 6
? 5 28
? 5 1
! 1
? 1 2
? 3 4
? 5 6
? 5 166
? 6 166
? 6 1
! 2

result:

ok Correct (4 test cases)

Test #41:

score: 0
Accepted
time: 3ms
memory: 3796kb

input:

1
1000
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0...

output:

? 1 2
? 3 4
? 5 6
? 7 8
? 9 10
? 11 12
? 13 14
? 15 16
? 17 18
? 19 20
? 21 22
? 23 24
? 25 26
? 27 28
? 29 30
? 31 32
? 33 34
? 35 36
? 37 38
? 39 40
? 41 42
? 43 44
? 45 46
? 47 48
? 49 50
? 51 52
? 53 54
? 55 56
? 57 58
? 59 60
? 61 62
? 63 64
? 65 66
? 67 68
? 69 70
? 71 72
? 73 74
? 75 76
? 77 ...

result:

ok Correct (1 test case)

Extra Test:

score: 0
Extra Test Passed