QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#106382#6303. InversionMelacauAC ✓256ms11308kbC++173.5kb2023-05-17 16:03:112023-05-17 16:03:16

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-05-17 16:03:16]
  • 评测
  • 测评结果:AC
  • 用时:256ms
  • 内存:11308kb
  • [2023-05-17 16:03:11]
  • 提交

answer

#include <bits/stdc++.h>

using namespace std;

using db = double;
using s64 = long long;
using ld = long double;
using u32 = unsigned int;
using u64 = unsigned long long;

using vi = vector<int>;
using vii = vector<vi>;
using vll = vector<s64>;

using pii = pair<int, int>;
#define fi first
#define se second
#define mp(a, b) make_pair(a, b)

#define For(i, a, b) for (decay<decltype(b)>::type i = (a), _##i = (b); i <= _##i; ++i)
#define Ford(i, a, b) for (decay<decltype(a)>::type i = (a), _##i = (b); i >= _##i; --i)
#define FOR(i, a, b) for (decay<decltype(b)>::type i = (a), _##i = (b); i < _##i; ++i)
#define FORD(i, a, b) for (decay<decltype(a)>::type i = (a) - 1, _##i = (b); i >= _##i; --i)

#ifdef LOCAL
#define Debug(x...) do { cerr << "\033[32;1m" << #x << " -> "; Err(x); } while (0)
void Err() { cerr << "\033[39;0m" << endl; }
template<template<typename...> class T, typename t, typename... A>
void Err(T<t> a, A... x) { for (auto v: a) cerr << v << ' '; Err(x...); }
template<typename T, typename... A>
void Err(T a, A... x) { cerr << a << ' '; Err(x...); }
#else
#define Debug(...)
#endif

#define all(x) x.begin(), x.end()

const double PI = acos(-1);
const double eps = 1e-7;

namespace Modulo {
	// const int P = 998244353;
	const int P = 1e9 + 7;
	int Add(int x, int y) {return (x += y) >= P ? x - P : x;}
	int Dec(int x, int y) {return (x -= y) < 0 ? x + P : x;}
	int Mult(int x, int y) {return (s64) x * y % P;}
	void mult(int &x, int y) {x = (s64) x * y % P;}
	void add(int &x, int y) {if ((x += y) >= P) x -= P;}
	void dec(int &x, int y) {if ((x -= y) < 0) x += P;}
	int qpw(int x, int k = P - 2) {
		int res = 1;
		for (; k; k >>= 1, mult(x, x))
			if (k & 1) mult(res, x);
		return res;
	}
}

namespace Solver {
    // const char endl = '\n';
    const int N = 2005;
    int ord[N], pos[N];
    bool cnt[N][N], vis[N][N];
    bool query(int x, int y) {
        if (!vis[x][y]) {
            cout << "? " << x << ' ' << y << endl;
            cin >> cnt[x][y];
            vis[x][y] = true;
        }
        if (x + 1 == y) return cnt[x][y] ^ 1;
        if (!vis[x + 1][y]) {
            cout << "? " << x + 1 << ' ' << y << endl;
            cin >> cnt[x + 1][y];
            vis[x + 1][y] = true;
        }
        return cnt[x][y] ^ cnt[x + 1][y] ^ cnt[x][y - 1] ^ cnt[x + 1][y - 1] ^ 1;
    }
	void main() {
        int n; cin >> n;
        ord[1] = 1;
        for (int i = 2; i <= n; ++i) {
            for (int j = 1; j < i; ++j)
                pos[ord[j]] = j;
            int l = 1, r = i;
            while (l < r) {
                int mid = l + r >> 1;
                if (query(pos[mid], i)) l = mid + 1;
                else r = mid;
            }
            for (int j = l; j < i; ++j) ord[pos[j]] = j + 1;
            ord[i] = l;
            // cerr << i << ' ' << l << endl;
            // for (int j = 1; j <= i; ++j)
            //     cerr << ord[j] << " \n"[j == i];
            // for (int j = 1; j <= i; ++j)
            //     cerr << cnt[j][i] << " \n"[j == i];
            for (int j = i - 1; j; --j)
                if (!vis[j][i]) cnt[j][i] = cnt[j + 1][i] ^ cnt[j][i - 1] ^ cnt[j + 1][i - 1] ^ (ord[j] > ord[i]);
            // for (int j = 1; j <= i; ++j)
            //     cerr << cnt[j][i] << " \n"[j == i];
        }
        cout << '!';
        for (int i = 1; i <= n; ++i)
            cout << ' ' << ord[i];
        cout << endl;
	}
}

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0); cout.tie(0);
	int T = 1;
	//cin >> T;
	For(_t, 1, T) {
		// cout << "Case #" << _t << ": ";
		// cout << endl;
		Solver::main();
	}
	return 0;
}
// 24513

詳細信息

Test #1:

score: 100
Accepted
time: 2ms
memory: 3348kb

input:

3
0
1
0

output:

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

result:

ok OK, guesses=3

Test #2:

score: 0
Accepted
time: 207ms
memory: 11036kb

input:

1993
0
0
0
0
0
1
1
0
0
0
0
0
1
0
1
0
0
1
0
0
1
1
0
1
0
1
1
1
1
1
0
0
1
1
1
1
0
0
0
0
0
0
0
0
0
0
0
1
0
1
1
1
1
1
1
0
0
1
1
0
0
0
0
1
0
1
1
0
0
0
1
0
0
1
0
0
1
0
0
1
1
1
0
0
1
0
1
1
1
1
1
1
0
0
0
0
0
1
0
0
1
0
1
1
0
1
1
0
0
1
1
0
0
0
1
1
0
1
0
1
0
0
1
1
0
1
1
0
1
1
1
0
1
0
1
0
0
0
0
0
1
1
1
1
0
0
0
1...

output:

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

result:

ok OK, guesses=37996

Test #3:

score: 0
Accepted
time: 217ms
memory: 10584kb

input:

1887
1
0
0
0
0
0
1
1
1
0
0
0
0
0
1
1
1
1
1
0
1
0
0
0
1
0
1
1
1
1
0
0
1
0
0
0
0
0
1
1
0
0
1
0
1
0
0
1
1
1
1
1
1
1
0
1
0
1
1
1
1
1
1
1
0
1
0
0
0
0
1
0
1
0
0
0
1
1
1
0
0
0
1
0
0
0
1
1
1
0
1
0
0
1
1
1
0
0
0
0
0
1
1
0
0
1
0
0
1
1
0
1
0
0
0
1
0
0
1
0
1
0
0
1
0
0
1
0
0
0
1
1
0
1
0
0
0
1
1
1
1
0
1
0
0
0
1
0...

output:

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

result:

ok OK, guesses=35504

Test #4:

score: 0
Accepted
time: 168ms
memory: 10564kb

input:

1882
1
1
0
0
0
1
1
0
0
0
1
1
0
0
0
1
1
1
1
1
1
0
1
1
0
1
1
1
1
0
1
1
1
0
1
0
0
0
0
1
0
1
1
1
1
0
1
0
1
1
1
1
1
0
0
1
1
0
0
0
0
1
1
1
1
1
0
0
0
1
1
1
0
0
1
0
1
1
0
1
0
1
1
1
0
0
1
1
0
1
1
1
1
1
1
1
1
1
0
1
0
0
1
0
1
1
1
0
0
0
1
0
0
0
0
0
1
1
0
0
1
1
0
1
0
0
0
1
0
0
0
0
1
1
0
1
0
0
0
1
1
1
1
1
1
0
1
1...

output:

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

result:

ok OK, guesses=35493

Test #5:

score: 0
Accepted
time: 220ms
memory: 10496kb

input:

1877
0
1
0
1
0
0
1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 7
? 1 7
? 2 7
? 3 8
? 4 8
? 5 8
? 2 8
? 3 9
? 4 9
? 1 9
? 2 9
? 5 9
? 6 9
? 3 10
? 4 10
? 8 10
? 9 10
? 2 10
? 3 11
? 4 11
? 8 11
? 9 11
? 5 11
? 6 11
? 7 11
? 10 12
? 11 12
? 4 12
? 5 12
? 2 12
? 3 1...

result:

ok OK, guesses=35190

Test #7:

score: 0
Accepted
time: 224ms
memory: 11228kb

input:

1994
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
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
? 2 3
? 2 4
? 3 4
? 3 5
? 4 5
? 3 6
? 4 6
? 5 6
? 4 7
? 5 7
? 6 7
? 4 8
? 5 8
? 6 8
? 7 8
? 5 9
? 6 9
? 7 9
? 8 9
? 5 10
? 6 10
? 8 10
? 9 10
? 6 11
? 7 11
? 9 11
? 10 11
? 6 12
? 7 12
? 9 12
? 10 12
? 11 12
? 7 13
? 8 13
? 10 13
? 11 13
? 12 13
? 7 14
? 8 14
? 11 14
? 12 14
? 13 14
? 8 15
? 9...

result:

ok OK, guesses=32793

Test #8:

score: 0
Accepted
time: 186ms
memory: 11096kb

input:

1990
0
0
0
1
1
0
0
1
0
0
0
1
0
0
1
1
1
1
0
0
1
1
0
0
1
0
1
0
1
0
1
1
1
0
1
1
1
1
0
0
1
1
1
0
0
0
0
0
0
1
1
0
0
0
0
0
0
0
1
1
1
0
0
1
0
1
0
0
1
1
1
1
0
1
0
1
1
1
1
0
1
1
0
0
0
1
1
1
1
1
0
0
0
0
0
1
1
1
1
0
1
0
0
0
1
0
1
0
1
1
0
1
1
1
1
0
1
1
1
1
1
1
0
1
0
1
1
1
1
0
0
1
1
0
0
0
0
0
0
1
0
1
1
0
1
1
1
0...

output:

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

result:

ok OK, guesses=34429

Test #9:

score: 0
Accepted
time: 190ms
memory: 11308kb

input:

1981
1
0
0
1
0
0
0
0
0
0
0
0
1
0
1
1
1
1
1
1
0
1
0
1
1
1
1
1
1
0
0
0
1
0
0
1
0
1
0
0
1
0
0
1
0
1
0
0
1
0
1
0
1
0
1
0
1
1
0
1
0
1
1
1
0
0
0
1
1
1
0
0
0
0
0
0
0
0
0
0
0
1
0
0
1
1
0
0
1
0
1
1
0
0
0
0
0
0
1
1
0
0
1
0
0
1
0
1
0
0
1
0
1
1
0
1
0
1
1
1
1
1
0
1
0
0
0
1
1
1
0
0
1
1
1
0
1
0
0
1
0
1
1
1
1
0
0
1...

output:

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

result:

ok OK, guesses=35836

Test #10:

score: 0
Accepted
time: 192ms
memory: 11280kb

input:

1988
0
1
1
0
0
1
0
0
1
0
1
1
1
1
1
1
1
0
1
0
0
1
1
1
0
1
1
1
1
1
1
0
0
0
0
1
1
0
1
0
0
0
1
1
0
0
1
1
1
0
0
1
0
0
0
0
1
1
0
0
0
0
1
1
0
1
1
0
1
1
1
0
0
0
0
0
1
0
0
1
1
0
0
1
1
0
1
1
1
0
1
1
0
0
1
0
1
1
0
0
1
1
1
1
0
0
1
1
0
0
1
1
0
0
0
0
1
1
1
0
0
0
0
0
1
1
1
1
0
1
1
1
0
1
1
1
0
1
0
1
0
0
0
1
1
1
1
0...

output:

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

result:

ok OK, guesses=36564

Test #11:

score: 0
Accepted
time: 152ms
memory: 10992kb

input:

1991
0
1
1
0
0
1
1
1
0
1
0
0
1
0
0
1
0
1
0
0
0
1
0
1
0
0
0
1
1
1
0
0
1
0
0
0
1
1
1
0
0
1
1
1
0
0
1
0
0
0
0
0
0
1
1
0
0
1
1
0
0
1
0
0
0
0
0
0
0
1
1
1
0
0
0
1
1
0
0
0
0
0
1
0
1
0
1
0
0
1
1
0
0
0
1
0
1
1
0
0
1
0
1
1
1
0
1
0
1
1
0
0
1
1
0
0
1
0
0
0
0
0
1
0
1
0
0
1
0
1
0
1
1
0
1
1
0
1
1
1
1
0
0
1
1
0
1
1...

output:

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

result:

ok OK, guesses=37509

Test #12:

score: 0
Accepted
time: 195ms
memory: 10940kb

input:

1996
0
1
0
1
0
0
0
1
0
0
0
0
0
1
1
0
1
0
1
1
1
1
1
0
1
1
0
1
0
0
1
1
1
1
0
0
0
1
1
1
0
0
0
1
1
1
0
0
0
1
1
1
1
0
1
1
1
0
1
0
0
0
1
0
1
0
0
0
0
0
1
0
1
1
1
1
1
1
0
1
0
1
0
0
1
0
1
0
1
1
0
0
1
1
0
1
0
0
0
1
0
1
1
1
1
1
1
0
0
0
1
1
0
0
1
0
0
0
0
0
0
0
0
0
0
0
1
1
0
0
0
1
0
0
1
0
0
0
0
0
0
0
0
1
1
0
1
1...

output:

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

result:

ok OK, guesses=37902

Test #13:

score: 0
Accepted
time: 219ms
memory: 11188kb

input:

1992
1
1
1
1
1
0
1
1
0
1
1
0
0
1
1
0
0
1
1
1
0
0
1
1
1
0
0
1
1
1
1
0
1
1
1
1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
? 4 9
? 5 9
? 3 10
? 4 10
? 8 10
? 9 10
? 7 10
? 1 10
? 2 10
? 10 11
? 2 11
? 3 11
? 4 11
? 5 11
? 9 11
? 3 12
? 4 12
? 5 12
? 11 12...

result:

ok OK, guesses=35654

Test #15:

score: 0
Accepted
time: 194ms
memory: 11152kb

input:

1983
1
1
1
0
0
0
0
1
0
1
1
1
1
1
0
1
0
0
0
1
1
0
1
1
1
1
1
1
1
0
0
0
1
0
0
0
0
1
0
0
0
0
1
1
0
1
1
0
0
1
1
1
1
0
1
1
1
1
1
1
1
0
0
0
1
0
1
1
1
1
0
1
0
0
1
0
0
1
1
1
1
0
0
1
0
0
1
0
0
0
0
0
1
0
0
0
0
0
1
0
1
0
1
0
1
0
0
1
1
0
0
0
0
1
0
0
0
0
0
1
1
1
1
0
0
1
1
0
0
1
0
1
1
0
1
1
1
1
1
1
0
0
1
1
0
0
1
0...

output:

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

result:

ok OK, guesses=36635

Test #16:

score: 0
Accepted
time: 256ms
memory: 11064kb

input:

1990
1
1
0
1
1
1
1
0
0
0
1
0
1
1
1
1
0
1
1
0
0
0
0
0
0
1
0
0
0
0
1
1
1
1
1
0
1
1
0
1
0
0
1
0
1
0
1
1
1
0
0
0
1
0
0
0
1
1
1
1
0
1
1
0
1
0
1
0
1
0
0
0
1
1
1
1
1
0
1
0
1
0
0
1
1
0
0
0
1
1
1
0
1
0
1
1
1
0
1
0
0
0
0
0
1
1
1
1
0
1
1
1
0
1
1
0
1
1
1
0
1
1
1
1
0
1
1
1
1
1
1
0
1
1
0
0
1
0
1
1
0
0
0
1
0
1
0
1...

output:

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

result:

ok OK, guesses=37249

Test #17:

score: 0
Accepted
time: 242ms
memory: 11168kb

input:

1989
1
0
0
0
0
0
0
0
0
1
0
0
0
1
0
1
0
1
0
1
0
0
0
1
0
1
0
1
0
1
1
1
1
1
1
1
0
1
1
0
1
0
1
0
0
0
1
1
0
0
0
0
0
1
1
1
1
1
1
0
1
0
1
0
1
1
1
1
0
1
0
1
0
0
1
1
1
0
0
0
0
0
0
0
1
0
0
1
0
1
0
1
1
0
1
0
0
1
0
1
0
0
1
0
1
1
1
0
0
1
1
1
0
0
0
1
0
0
0
1
0
1
1
1
0
1
1
0
1
0
0
0
0
0
1
1
0
0
0
1
0
0
0
1
0
1
1
1...

output:

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

result:

ok OK, guesses=37619

Test #18:

score: 0
Accepted
time: 211ms
memory: 10992kb

input:

1998
0
1
0
0
0
0
1
0
1
1
1
1
1
1
1
1
1
0
0
0
0
1
0
0
1
0
0
0
0
0
1
0
0
1
1
0
1
1
0
0
0
0
0
0
0
1
0
1
0
0
1
0
1
1
0
0
1
0
0
0
0
0
1
1
1
1
0
1
1
0
0
0
0
0
0
1
0
0
0
0
0
0
1
0
0
0
1
1
0
1
0
1
0
0
0
0
1
0
0
0
0
0
1
0
1
1
0
1
0
1
0
1
1
1
1
0
0
1
0
1
0
1
1
1
1
0
1
0
1
1
0
0
1
1
0
0
0
1
0
1
0
0
0
0
1
1
1
0...

output:

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

result:

ok OK, guesses=37920

Test #19:

score: 0
Accepted
time: 2ms
memory: 3372kb

input:

1

output:

! 1

result:

ok OK, guesses=0

Test #20:

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

input:

2
0

output:

? 1 2
! 1 2

result:

ok OK, guesses=1

Test #21:

score: 0
Accepted
time: 2ms
memory: 3296kb

input:

2
1

output:

? 1 2
! 2 1

result:

ok OK, guesses=1

Test #22:

score: 0
Accepted
time: 168ms
memory: 11172kb

input:

1997
1
1
0
1
1
1
1
1
1
0
1
1
1
1
1
0
1
1
1
1
1
1
1
1
1
1
1
0
1
1
1
1
1
1
1
1
1
0
1
1
1
1
1
1
1
0
1
1
1
1
1
1
1
1
1
1
0
1
1
1
1
1
1
1
1
1
1
1
1
1
1
0
1
1
1
1
1
1
1
1
1
1
1
1
1
0
1
1
1
1
1
1
1
1
1
1
1
1
0
1
1
1
1
1
1
1
1
1
1
1
1
1
0
1
1
1
1
1
1
1
1
1
1
1
0
1
1
1
1
1
1
1
1
1
1
1
1
0
1
1
1
1
1
1
1
1
1
1...

output:

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

result:

ok OK, guesses=33724

Test #23:

score: 0
Accepted
time: 210ms
memory: 11284kb

input:

1998
1
1
0
1
1
1
1
1
1
0
1
1
1
1
1
0
1
1
1
1
1
1
1
1
1
1
1
0
1
1
1
1
1
1
1
1
1
0
1
1
1
1
1
1
1
0
1
1
1
1
1
1
1
1
1
1
0
1
1
1
1
1
1
1
1
1
1
1
1
1
1
0
1
1
1
1
1
1
1
1
1
1
1
1
1
0
1
1
1
1
1
1
1
1
1
1
1
1
0
1
1
1
1
1
1
1
1
1
1
1
1
1
0
1
1
1
1
1
1
1
1
1
1
1
0
1
1
1
1
1
1
1
1
1
1
1
1
0
1
1
1
1
1
1
1
1
1
1...

output:

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

result:

ok OK, guesses=33745

Test #24:

score: 0
Accepted
time: 203ms
memory: 11220kb

input:

1999
1
1
0
1
1
1
1
1
1
0
1
1
1
1
1
0
1
1
1
1
1
1
1
1
1
1
1
0
1
1
1
1
1
1
1
1
1
0
1
1
1
1
1
1
1
0
1
1
1
1
1
1
1
1
1
1
0
1
1
1
1
1
1
1
1
1
1
1
1
1
1
0
1
1
1
1
1
1
1
1
1
1
1
1
1
0
1
1
1
1
1
1
1
1
1
1
1
1
0
1
1
1
1
1
1
1
1
1
1
1
1
1
0
1
1
1
1
1
1
1
1
1
1
1
0
1
1
1
1
1
1
1
1
1
1
1
1
0
1
1
1
1
1
1
1
1
1
1...

output:

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

result:

ok OK, guesses=33763

Test #25:

score: 0
Accepted
time: 216ms
memory: 11176kb

input:

2000
1
1
0
1
1
1
1
1
1
0
1
1
1
1
1
0
1
1
1
1
1
1
1
1
1
1
1
0
1
1
1
1
1
1
1
1
1
0
1
1
1
1
1
1
1
0
1
1
1
1
1
1
1
1
1
1
0
1
1
1
1
1
1
1
1
1
1
1
1
1
1
0
1
1
1
1
1
1
1
1
1
1
1
1
1
0
1
1
1
1
1
1
1
1
1
1
1
1
0
1
1
1
1
1
1
1
1
1
1
1
1
1
0
1
1
1
1
1
1
1
1
1
1
1
0
1
1
1
1
1
1
1
1
1
1
1
1
0
1
1
1
1
1
1
1
1
1
1...

output:

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

result:

ok OK, guesses=33784