QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#135688#6303. InversionSwarthmore#AC ✓101ms3660kbC++173.4kb2023-08-05 21:52:522023-08-05 21:52:54

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-08-05 21:52:54]
  • 评测
  • 测评结果:AC
  • 用时:101ms
  • 内存:3660kb
  • [2023-08-05 21:52:52]
  • 提交

answer

#include "bits/stdc++.h"
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")
 
using namespace std;
 
typedef long long ll;
typedef long double ld;
typedef complex<ld> cd;
 
typedef pair<int, int> pi;
typedef pair<ll,ll> pl;
typedef pair<ld,ld> pd;
 
typedef vector<int> vi;
typedef vector<ld> vd;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;
typedef vector<cd> vcd;

template<class T> using pq = priority_queue<T>;
template<class T> using pqg = priority_queue<T, vector<T>, greater<T>>;
 
#define FOR(i, a, b) for (int i=a; i<(b); i++)
#define F0R(i, a) for (int i=0; i<(a); i++)
#define FORd(i,a,b) for (int i = (b)-1; i >= a; i--)
#define F0Rd(i,a) for (int i = (a)-1; i >= 0; i--)
#define trav(a,x) for (auto& a : x)
#define uid(a, b) uniform_int_distribution<int>(a, b)(rng)
 
#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()
#define ins insert

template<class T> bool ckmin(T& a, const T& b) { return b < a ? a = b, 1 : 0; }
template<class T> bool ckmax(T& a, const T& b) { return a < b ? a = b, 1 : 0; }
 
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

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...);}
#ifdef DEBUG
#define dbg(x...) cerr << "\e[91m"<<__func__<<":"<<__LINE__<<" [" << #x << "] = ["; _print(x); cerr << "\e[39m" << endl;
#else
#define dbg(x...)
#endif


const int MOD = 1000000007;
const char nl = '\n';
const int MX = 100001; 

int query(int L, int R) {
    cout << "? " << L+1 << " " << R+1 << endl;
    int ans; cin >> ans; return ans;
}

void solve() {
    int N; cin >> N;
    int pos[N];
    pos[0] = 0;
    FOR(i, 1, N) {
        int lo = 0, hi = i;
        while (lo < hi) {
            int mid = (lo+hi)/2;
            int cnt = 0; F0R(j, mid) if (pos[j] > pos[mid]) cnt++;
            if (query(pos[mid], i) != (query(pos[mid]+1, i)+cnt)%2) {
                hi = mid;
            } else {
                lo = mid+1;
            }
        }
        FORd(j, lo+1, i+1) {
            pos[j] = pos[j-1];
        }
        pos[lo] = i;
    }
    int ans[N]; F0R(i, N) ans[pos[i]] = i+1;
    cout << "! ";
    F0R(i, N) {
        cout << ans[i] << " ";
    }
    cout << endl;

}
 
int main() {
    ios_base::sync_with_stdio(0); cin.tie(0);

    int T = 1;
//    cin >> T;
    while(T--) {
        solve();
    }

	return 0;
}



詳細信息

Test #1:

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

input:

3
0
0
1
0
0
1

output:

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

result:

ok OK, guesses=6

Test #2:

score: 0
Accepted
time: 94ms
memory: 3576kb

input:

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

output:

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

result:

ok OK, guesses=38280

Test #3:

score: 0
Accepted
time: 67ms
memory: 3496kb

input:

1887
1
0
0
0
0
0
0
0
0
0
1
1
1
0
0
0
0
0
0
0
0
1
1
1
1
1
0
0
1
0
0
0
0
1
0
0
1
0
1
1
1
0
0
1
0
0
0
0
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
1
0
0
1
1
0
0
0
0
0
1
0
0
1
0
0
0
0
1
1
1
0
0
0
0
1
0
0
0
1
1
1
0
1
0
0
1
0
1
1
1
0
0
0
0
0
0
1
0
1
0
0
1
0
0
0
1
1
0
1
0
0
0
1
0
0
0
1
0...

output:

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

result:

ok OK, guesses=35840

Test #4:

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

input:

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

output:

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

result:

ok OK, guesses=35780

Test #5:

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

input:

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

result:

ok OK, guesses=35508

Test #7:

score: 0
Accepted
time: 89ms
memory: 3492kb

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

result:

ok OK, guesses=35808

Test #8:

score: 0
Accepted
time: 98ms
memory: 3656kb

input:

1990
0
0
0
0
0
1
1
0
0
0
1
0
0
0
0
0
1
0
0
1
1
1
1
0
1
0
0
1
1
0
0
1
0
0
1
0
1
0
1
1
1
1
0
0
1
1
1
1
0
0
0
0
1
1
1
0
1
0
0
0
0
0
1
1
0
0
0
0
0
0
0
0
1
0
1
1
1
0
0
1
0
1
0
0
1
1
1
0
1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 10
? 8 10
? 9 10
? 9 10
? 10 10
? 5...

result:

ok OK, guesses=37424

Test #10:

score: 0
Accepted
time: 50ms
memory: 3496kb

input:

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

output:

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

result:

ok OK, guesses=37752

Test #11:

score: 0
Accepted
time: 74ms
memory: 3656kb

input:

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

output:

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

result:

ok OK, guesses=38000

Test #12:

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

input:

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

output:

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

result:

ok OK, guesses=38234

Test #13:

score: 0
Accepted
time: 98ms
memory: 3656kb

input:

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

result:

ok OK, guesses=38876

Test #15:

score: 0
Accepted
time: 36ms
memory: 3620kb

input:

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

output:

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

result:

ok OK, guesses=38370

Test #16:

score: 0
Accepted
time: 45ms
memory: 3576kb

input:

1990
1
0
1
0
1
1
1
1
1
0
0
0
0
0
1
0
1
1
1
0
1
0
1
1
0
0
0
0
0
0
0
0
1
0
0
0
0
0
1
1
1
0
0
1
1
0
0
1
1
0
0
1
0
0
1
0
1
0
0
1
1
1
0
0
0
1
0
0
0
1
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? 8 10
? 9 10
? 10 10
? 5 10
? 6 10
? 5 11
? 6 11
? 6 11
? 7 11
? 4 11
? 5 ...

result:

ok OK, guesses=38166

Test #18:

score: 0
Accepted
time: 101ms
memory: 3624kb

input:

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

output:

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

result:

ok OK, guesses=38318

Test #19:

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

input:

1

output:

! 1 

result:

ok OK, guesses=0

Test #20:

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

input:

2
0
0

output:

? 1 2
? 2 2
! 1 2 

result:

ok OK, guesses=2

Test #21:

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

input:

2
1
0

output:

? 1 2
? 2 2
! 2 1 

result:

ok OK, guesses=2

Test #22:

score: 0
Accepted
time: 37ms
memory: 3496kb

input:

1997
1
0
1
0
1
1
1
1
1
1
1
0
1
1
1
0
1
1
0
0
1
0
1
1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 7
? 6 8
? 7 8
? 5 8
? 6 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
? 8 11
? 9 11
? 10 11
? 8 12
? 9 ...

result:

ok OK, guesses=36862

Test #24:

score: 0
Accepted
time: 51ms
memory: 3624kb

input:

1999
1
0
1
0
1
1
1
1
1
1
1
0
1
1
1
0
1
1
0
0
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
0
1
1
1
1
1
0
1
1
1
1
0
0
1
0
1
1
1
1
1
0
1
1
1
1
0
0
1
0
1
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
1
1
0
1
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
1
1
0
1
1
1
1
1
1
1
0
1
1...

output:

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

result:

ok OK, guesses=36882

Test #25:

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

input:

2000
1
0
1
0
1
1
1
1
1
1
1
0
1
1
1
0
1
1
0
0
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
0
1
1
1
1
1
0
1
1
1
1
0
0
1
0
1
1
1
1
1
0
1
1
1
1
0
0
1
0
1
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
1
1
0
1
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
1
1
0
1
1
1
1
1
1
1
0
1
1...

output:

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

result:

ok OK, guesses=36904