QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#601510 | #9432. Permutation | kevinshan# | AC ✓ | 346ms | 3912kb | C++23 | 5.1kb | 2024-09-30 03:24:06 | 2024-09-30 03:24:06 |
Judging History
answer
#pragma GCC optimize("Ofast,O3,unroll-loops")
#include <bits/stdc++.h>
#include <cstdint>
#include <cassert>
using namespace std;
#define ll long long
#define all(x) x.begin(), x.end()
#define pb push_back
#define f first
#define s second
#define ca(x) for(auto i:x) cout<<i<<" ";
#define vi vector<int>
std::random_device rd;
std::mt19937 gen;
void shuffle_vec(vi& vec) {
shuffle(begin(vec), end(vec), gen);
}
int n;
void query(vi &q, vi &p, int type) {
cout<<type<<" ";
for(int i=0; i<n; i++) {
cout<<q[p[i]]+1<<" ";
}
cout<<endl;
}
vi blanks;
vi distr(vi &ans, int a, int b, int l_a, int r_a, int l_b, int r_b) {
vi out(n,-1);
vi new_positions(n);
int cnt = 0;
for(int i=0; i<n; i++) {
cnt += (ans[i] == -1);
if(ans[i] == -1) new_positions[cnt-1] = i;
}
for(int i=l_a; i<=r_a; i++) {
out[new_positions[i]] = a;
}
for(int i=l_b; i<=r_b; i++) {
out[new_positions[i]] = b;
}
for(int i=0; i<n; i++) {
if(out[i] == -1) out[i] = blanks[i];
}
return out;
}
int main()
{
// ios_base::sync_with_stdio(0); cin.tie(0);
std::random_device rd;
std::mt19937 gen(rd());
// if (fopen("input.in", "r")) {
// freopen("input.in", "r", stdin);
// freopen("output.out", "w", stdout);
// }
int x;
cin>>n;
vi pos(n);
iota(all(pos), 0);
shuffle_vec(pos);
vi guess(n);
iota(all(guess), 0);
shuffle_vec(guess);
vi ans(n, -1);
if(n <= 7) {
vector<int> perm(n);
iota(all(perm), 0);
do {
query(perm, pos, 0);
cin>>x;
if(x == n) {
query(perm, pos, 1);
return 0;
}
} while(next_permutation(all(perm)));
assert(1 == 0);
return 0;
}
blanks = vi(n);
for(int i=0; i<n-1; i++) {
int a = guess[i];
int b = guess[i+1];
int m = n/2;
auto d = distr(ans,a,b,0,m,m+1,n-1);
query(d,pos,0);
cin>>x;
if(x == 0) {
// means neither
for(int i=0; i<=m; i++) blanks[i] = a;
for(int i=m+1; i<n; i++) blanks[i] = b;
break;
}
else if(x == 2) {
for(int i=0; i<=m; i++) blanks[i] = b;
for(int i=m+1; i<n; i++) blanks[i] = a;
break;
}
}
// now blanks is filled
vi new_guess;
for(auto g:guess) {
if(g != blanks[0] && g != blanks.back()) new_guess.pb(g);
}
guess = new_guess;
vi d;
int last_a;
int last_a_p;
int correct = 0;
for(int i=0; i<n-2; i+=2) {
vi new_positions(n);
int cnt = 0;
for(int i=0; i<n; i++) {
cnt += (ans[i] == -1);
if(ans[i] == -1) new_positions[cnt-1] = i;
}
if(i == n-3) {
int a = guess[i];
int a_l = 0;
int a_r = n-correct-1;
while(a_l < a_r) {
int m_a = (a_l + a_r) / 2;
d = distr(ans, a, -1, a_l, m_a, 0, -1);
query(d, pos, 0);
cin>>x;
if(x == 0) {
a_l = m_a+1;
} else {
a_r = m_a;
}
}
ans[new_positions[a_l]] = a;
break;
}
int a = guess[i];
int a_l = 0, b_l = 0;
int a_r = n-correct-1;
int b_r = n-correct-1;
int b = guess[i+1];
while(a_l < a_r || b_l < b_r) {
if(b_l == b_r) {
swap(a_l, b_l);
swap(a_r, b_r);
swap(a, b);
}
int m_a = (a_l + a_r) / 2;
int m_b = (b_l + b_r) / 2;
// so we query a_l, m_a and m_b+1, b_r
d = distr(ans, a, b, a_l, m_a, m_b+1, b_r);
query(d, pos, 0);
cin>>x;
if(x == 0) {
// both invalid
a_l = m_a + 1;
b_r = m_b;
}
else if(x == 2) {
// both valid
a_r = m_a;
b_l = m_b + 1;
}
else {
// only query one
d = distr(ans, a, b, a_l, m_a, 0, -1);
query(d, pos, 0);
cin>>x;
if(x == 0) {
// means b is valid, a invalid
b_l = m_b + 1;
a_l = m_a + 1;
}
else {
// means a is valid, b invalid
a_r = m_a;
b_r = m_b;
}
}
}
ans[new_positions[a_l]] = a;
ans[new_positions[b_l]] = b;
correct += 2;
}
for(int i=0; i<=n/2; i++) {
if(ans[i] == -1) ans[i] = blanks.back();
}
for(int i=n/2+1; i<n; i++) {
if(ans[i] == -1) ans[i] = blanks[0];
}
query(ans, pos, 1);
}
詳細信息
Test #1:
score: 100
Accepted
time: 1ms
memory: 3600kb
input:
5 1 1 3 2 2 1 1 1 2 3 1 2 2 1 1 2 1 3 3 2 2 3 3 5
output:
0 4 3 5 1 2 0 5 3 4 1 2 0 3 4 5 1 2 0 5 4 3 1 2 0 3 5 4 1 2 0 4 5 3 1 2 0 4 2 5 1 3 0 5 2 4 1 3 0 2 4 5 1 3 0 5 4 2 1 3 0 2 5 4 1 3 0 4 5 2 1 3 0 3 2 5 1 4 0 5 2 3 1 4 0 2 3 5 1 4 0 5 3 2 1 4 0 2 5 3 1 4 0 3 5 2 1 4 0 3 2 4 1 5 0 4 2 3 1 5 0 2 3 4 1 5 0 4 3 2 1 5 0 2 4 3 1 5 0...
result:
ok Accepted
Test #2:
score: 0
Accepted
time: 337ms
memory: 3616kb
input:
1000 0 1 0 1 1 1 0 2 1 1 1 0 0 2 2 2 0 2 2 0 1 0 1 1 1 1 0 0 0 1 0 1 0 1 0 1 0 0 1 1 1 0 1 1 2 1 0 1 1 1 0 1 0 1 1 1 1 2 2 0 1 0 1 1 2 1 1 2 1 0 0 2 1 0 0 0 1 0 1 1 0 2 0 1 1 0 1 1 0 0 1 1 2 1 1 1 1 2 1 0 1 1 2 1 0 1 1 1 0 1 1 1 1 1 1 0 2 1 1 1 1 1 0 1 1 1 0 1 1 0 0 2 1 1 1 0 2 1 1 0 1 0 1 1 1 1 0 1...
output:
0 805 805 805 805 712 805 712 805 712 805 712 712 805 712 805 712 805 805 805 712 805 712 712 712 712 712 805 805 712 712 712 805 805 712 712 712 712 805 712 805 712 805 712 805 712 805 712 712 712 805 805 712 712 712 805 805 805 805 805 805 805 712 712 712 805 805 712 805 805 805 712 712 712 712 80...
result:
ok Accepted
Test #3:
score: 0
Accepted
time: 1ms
memory: 3620kb
input:
1 1
output:
0 1 1 1
result:
ok Accepted
Test #4:
score: 0
Accepted
time: 0ms
memory: 3868kb
input:
2 0 2
output:
0 1 2 0 2 1 1 2 1
result:
ok Accepted
Test #5:
score: 0
Accepted
time: 1ms
memory: 3596kb
input:
3 1 0 0 1 1 3
output:
0 1 3 2 0 1 2 3 0 2 3 1 0 2 1 3 0 3 2 1 0 3 1 2 1 3 1 2
result:
ok Accepted
Test #6:
score: 0
Accepted
time: 0ms
memory: 3600kb
input:
4 2 0 1 0 0 1 4
output:
0 3 4 1 2 0 4 3 1 2 0 2 4 1 3 0 4 2 1 3 0 2 3 1 4 0 3 2 1 4 0 3 4 2 1 1 3 4 2 1
result:
ok Accepted
Test #7:
score: 0
Accepted
time: 1ms
memory: 3564kb
input:
6 2 3 1 2 1 1 0 1 0 1 0 0 0 1 1 2 0 0 0 0 1 1 0 0 1 2 0 1 0 0 0 1 0 1 0 0 0 1 1 2 0 0 0 0 1 1 0 0 0 1 0 1 0 0 1 2 1 2 1 1 0 1 0 1 0 0 0 0 0 0 0 0 1 2 2 3 1 1 2 3 3 4 2 2 1 2 1 2 1 1 1 1 1 1 2 2 0 0 1 1 0 0 1 1 2 2 1 1 0 0 0 0 0 0 0 0 0 0 1 1 3 4 2 3 2 2 1 2 1 2 1 1 1 2 2 3 1 1 1 1 2 2 1 1 2 3 1 2 1 ...
output:
0 3 4 1 6 5 2 0 3 4 1 5 6 2 0 3 5 1 6 4 2 0 3 5 1 4 6 2 0 3 6 1 5 4 2 0 3 6 1 4 5 2 0 4 3 1 6 5 2 0 4 3 1 5 6 2 0 4 5 1 6 3 2 0 4 5 1 3 6 2 0 4 6 1 5 3 2 0 4 6 1 3 5 2 0 5 3 1 6 4 2 0 5 3 1 4 6 2 0 5 4 1 6 3 2 0 5 4 1 3 6 2 0 5 6 1 4 3 2 0 5 6 1 3 4 2 0 6 3 1 5 4 2 0 6 3 1 4 5 2 ...
result:
ok Accepted
Test #8:
score: 0
Accepted
time: 3ms
memory: 3828kb
input:
7 0 0 1 0 1 0 0 0 0 0 0 0 1 0 0 0 0 1 1 0 0 0 0 1 1 1 2 1 2 1 0 0 0 0 0 0 1 0 0 0 0 1 1 0 0 0 0 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 2 1 1 1 1 2 1 0 0 0 0 1 0 0 0 0 0 0 0 1 0 1 0 0 3 2 2 2 2 3 2 1 1 1 1 2 1 1 1 1 1 1 1 2 1 2 1 1 0 0 1 0 1 0 0 0 0 0 0 0 1 0 0 0 0 1 1 0 0 0 0 1 0 0 1 0 1 ...
output:
0 4 3 5 7 2 6 1 0 4 3 5 6 2 7 1 0 4 3 6 7 2 5 1 0 4 3 6 5 2 7 1 0 4 3 7 6 2 5 1 0 4 3 7 5 2 6 1 0 5 3 4 7 2 6 1 0 5 3 4 6 2 7 1 0 5 3 6 7 2 4 1 0 5 3 6 4 2 7 1 0 5 3 7 6 2 4 1 0 5 3 7 4 2 6 1 0 6 3 4 7 2 5 1 0 6 3 4 5 2 7 1 0 6 3 5 7 2 4 1 0 6 3 5 4 2 7 1 0 6 3 7 5 2 4 1 0 6 3 7 4 2...
result:
ok Accepted
Test #9:
score: 0
Accepted
time: 1ms
memory: 3788kb
input:
8 1 1 1 1 2 1 1 2 2 1 1 2 2 2 0
output:
0 2 2 2 7 2 7 7 2 0 7 7 7 3 7 3 3 7 0 3 3 3 6 3 6 6 3 0 6 6 6 8 6 8 8 6 0 8 8 8 4 8 4 4 8 0 2 2 2 7 7 7 7 2 0 2 2 2 8 4 8 8 2 0 7 7 2 8 4 8 8 2 0 4 7 2 8 4 8 8 4 0 3 4 4 6 3 6 6 3 0 3 4 4 8 3 8 8 3 0 3 4 4 8 6 8 8 3 0 3 4 4 8 6 8 8 4 0 4 4 4 1 4 5 5 1 0 4 4 4 8 4 8 5 1 1 3 7 2 1 6 5 4...
result:
ok Accepted
Test #10:
score: 0
Accepted
time: 1ms
memory: 3600kb
input:
9 1 1 1 2 1 1 0 1 1 1 1 2 0 2 2 1 1 1 1 0
output:
0 3 3 3 8 3 8 8 3 8 0 8 8 8 2 8 2 2 8 2 0 2 2 2 7 2 7 7 2 7 0 7 7 7 5 7 5 5 7 5 0 3 3 3 8 3 8 8 3 8 0 3 3 3 7 3 7 7 3 7 0 8 3 8 7 3 7 7 3 7 0 3 8 5 7 5 7 7 5 7 0 3 5 5 7 5 7 7 5 7 0 3 5 5 7 8 7 7 5 7 0 3 5 5 7 5 7 7 5 7 0 5 2 2 6 2 2 6 5 6 0 5 2 5 7 2 7 6 5 7 0 5 5 2 7 5 7 7 5 6 0 5 9 ...
result:
ok Accepted
Test #11:
score: 0
Accepted
time: 0ms
memory: 3856kb
input:
10 2 1 1 0 0 2 0 1 0 1 0 0 0 1 1 0 0
output:
0 6 5 6 6 6 5 5 6 6 5 0 9 8 9 8 9 8 8 9 9 8 0 9 6 9 5 9 6 6 9 9 6 0 9 6 9 5 8 6 6 9 8 6 0 8 6 5 5 5 6 6 5 9 6 0 5 6 5 5 9 6 6 8 5 6 0 7 1 7 7 5 1 1 5 7 1 0 5 6 5 1 5 7 7 5 1 6 0 5 6 5 5 5 7 7 5 5 6 0 5 6 5 1 5 6 6 5 5 7 0 5 6 5 5 5 6 6 5 5 7 0 2 6 2 5 5 10 10 5 2 10 0 5 6 5 5 5 2 2 5 10 ...
result:
ok Accepted
Test #12:
score: 0
Accepted
time: 1ms
memory: 3632kb
input:
11 2 1 0 1 0 2 0 1 0 1 0 1 1 1 0 0 0 2 1 0
output:
0 11 6 6 6 11 11 6 11 6 11 11 0 7 10 10 10 7 7 10 7 10 7 7 0 7 11 11 11 7 7 11 7 11 7 7 0 6 10 10 7 6 6 7 6 7 6 6 0 6 11 11 7 6 6 7 6 7 6 6 0 6 7 10 11 6 6 11 6 11 6 6 0 4 11 11 8 4 8 8 4 8 4 4 0 8 11 11 4 6 4 11 6 11 6 8 0 6 11 11 4 6 4 11 6 11 6 6 0 6 11 11 11 6 6 11 6 4 6 8 0 6 11 11 11...
result:
ok Accepted
Test #13:
score: 0
Accepted
time: 0ms
memory: 3576kb
input:
12 2 1 0 0 1 1 1 1 0 1 1 2 1 1 1 0 0 1 0 1 1 1 1 2 0 2
output:
0 12 8 12 12 12 12 8 8 12 8 8 12 0 7 5 7 7 7 5 5 5 7 5 5 7 0 7 12 7 7 7 8 12 12 7 12 12 7 0 8 5 8 8 8 7 7 5 8 7 5 8 0 8 7 8 8 8 8 12 12 8 5 7 8 0 8 7 8 8 8 8 12 12 8 12 7 8 0 8 7 8 8 8 8 5 12 8 12 12 8 0 8 7 8 8 8 8 12 12 8 12 12 8 0 1 12 1 3 1 8 3 3 1 3 3 1 0 8 12 8 1 3 8 1 12 3 1 12 8 0 ...
result:
ok Accepted
Test #14:
score: 0
Accepted
time: 1ms
memory: 3636kb
input:
13 0 2 1 0 1 1 2 2 1 1 2 2 0 0 1 0 2 0 2 1 1 2 1 1 1 0
output:
0 10 2 2 10 10 10 2 10 2 10 10 2 2 0 8 6 6 8 8 8 6 8 6 8 8 6 6 0 8 2 6 10 8 10 2 8 6 8 10 6 2 0 8 2 2 10 8 10 2 8 2 8 10 2 2 0 10 2 2 10 10 8 2 10 6 10 8 2 2 0 10 2 2 10 10 8 2 10 2 10 8 2 2 0 10 2 2 10 10 10 2 10 2 10 8 6 2 0 9 7 7 9 9 9 7 9 7 9 10 2 7 0 10 2 7 10 9 10 2 9 7 9 10 2 2 0 10 ...
result:
ok Accepted
Test #15:
score: 0
Accepted
time: 0ms
memory: 3564kb
input:
14 1 1 2 1 1 1 1 0 1 0 2 1 1 1 0 1 1 1 0 2 0 0 0 1 0 0 1 1 2 0
output:
0 12 5 12 12 12 12 12 5 12 5 5 5 5 12 0 5 13 5 5 5 5 5 13 5 13 13 13 13 5 0 13 11 13 13 13 13 13 11 13 11 11 11 11 13 0 12 5 12 12 12 12 5 5 12 5 5 5 5 12 0 12 13 12 12 12 12 11 13 12 13 13 13 13 12 0 12 13 12 5 5 5 11 13 12 13 13 13 13 12 0 12 13 12 11 11 11 11 13 12 13 13 13 13 12 0 5 13 12...
result:
ok Accepted
Test #16:
score: 0
Accepted
time: 0ms
memory: 3500kb
input:
15 2 1 0 2 0 0 1 1 1 1 0 0 0 0 1 1 1 1 1 1 1 1 2 1 1 0 1 1 1 0 1 1 0 2 1 0
output:
0 8 6 6 8 8 8 6 8 6 8 8 6 6 8 6 0 14 12 12 14 14 14 12 14 12 14 14 12 12 14 12 0 14 8 8 14 14 14 8 14 8 14 14 8 8 14 8 0 6 14 14 6 6 6 14 6 12 6 6 12 12 6 14 0 6 14 8 6 6 6 14 6 8 6 6 12 8 6 8 0 6 8 14 6 6 6 8 6 8 6 6 8 12 6 8 0 13 11 11 13 13 13 11 13 8 13 13 11 11 11 8 0 13 8 8 13 13 13 8 1...
result:
ok Accepted
Test #17:
score: 0
Accepted
time: 271ms
memory: 3640kb
input:
975 2 1 0 1 0 2 2 1 1 0 2 1 1 2 0 1 0 1 0 0 1 0 1 0 2 1 1 1 0 2 2 1 0 2 2 0 0 0 1 1 1 1 1 0 0 1 0 1 0 1 0 1 0 2 1 0 1 0 1 1 1 1 2 1 0 1 1 1 0 0 0 1 1 1 1 1 0 1 1 1 0 1 1 1 1 1 0 1 1 2 0 1 1 1 0 1 1 1 1 0 2 1 0 2 1 1 0 1 0 2 0 1 1 1 0 1 1 2 0 2 1 1 1 1 1 0 0 2 2 1 0 2 2 0 0 1 0 1 1 1 0 2 2 1 0 1 1 2 ...
output:
0 383 832 383 832 383 832 832 832 383 832 383 832 832 383 383 383 383 832 832 383 832 383 832 383 383 832 832 383 383 383 383 832 832 832 383 832 383 832 832 383 383 832 383 832 383 832 832 383 832 383 832 383 832 832 383 832 832 832 832 383 832 383 832 383 383 383 832 832 832 832 383 832 383 383 83...
result:
ok Accepted
Test #18:
score: 0
Accepted
time: 317ms
memory: 3604kb
input:
976 2 0 1 0 1 1 0 1 0 1 0 1 0 1 0 1 1 1 1 1 1 1 0 1 1 2 0 0 1 1 2 1 0 1 0 1 0 2 1 1 2 2 1 1 0 1 1 1 0 2 1 0 0 2 1 0 0 1 1 0 1 1 0 0 0 0 0 2 1 1 1 1 1 1 1 1 0 1 0 1 0 0 1 0 1 0 1 0 1 0 0 1 1 1 0 1 0 1 1 0 0 0 2 1 1 1 0 1 0 2 2 1 1 1 0 1 0 2 1 0 0 1 1 2 1 0 1 1 0 1 1 1 0 0 0 2 1 0 1 0 2 2 0 0 2 0 1 0 ...
output:
0 829 829 829 829 115 829 115 829 115 829 115 829 829 115 829 115 115 829 829 115 829 115 115 115 115 829 829 829 115 115 115 829 829 115 115 115 115 829 115 829 115 829 115 829 115 829 115 115 115 829 829 115 115 115 829 829 829 829 829 829 829 115 115 115 829 829 115 829 829 829 115 115 115 115 82...
result:
ok Accepted
Test #19:
score: 0
Accepted
time: 279ms
memory: 3680kb
input:
977 1 2 1 1 2 0 1 0 0 0 1 0 2 1 1 1 1 2 0 0 1 1 1 1 0 1 1 2 2 1 1 1 0 2 1 0 1 0 1 0 1 1 2 2 0 0 1 0 2 1 0 2 0 0 0 1 1 1 0 0 1 0 2 1 1 2 1 1 1 1 1 0 1 0 0 1 0 1 0 1 0 0 2 1 0 1 0 0 1 1 0 1 1 1 0 1 1 0 1 0 1 0 0 2 2 1 0 2 2 2 0 1 1 2 0 0 0 2 0 1 0 2 1 0 0 1 1 2 1 1 0 0 0 1 1 1 1 0 0 2 0 2 1 0 0 2 1 0 ...
output:
0 116 830 116 830 116 830 830 830 116 830 116 830 830 116 116 116 116 830 830 116 830 116 830 116 116 830 830 116 116 116 116 830 830 830 116 830 116 830 830 116 116 830 116 830 116 830 830 116 830 116 830 116 830 830 116 830 830 830 830 116 830 116 830 116 116 116 830 830 830 830 116 830 116 116 83...
result:
ok Accepted
Test #20:
score: 0
Accepted
time: 307ms
memory: 3832kb
input:
978 1 0 1 0 1 0 0 1 0 1 1 1 0 1 0 2 2 2 1 0 1 1 1 1 2 2 0 2 1 0 0 1 1 2 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 0 0 0 2 0 1 1 2 2 1 0 0 2 1 1 2 1 0 1 1 2 2 2 1 1 1 0 2 2 1 1 1 0 2 0 1 0 2 2 1 1 1 1 2 1 1 2 1 1 2 0 1 1 1 0 1 0 2 0 2 2 0 1 0 0 2 2 1 0 1 0 1 0 2 0 0 1 0 1 0 2 1 1 2 0 1 1 1 0 2 1 0 2 1 0 0 0 ...
output:
0 827 827 827 827 394 827 394 827 394 827 394 827 827 394 827 394 394 827 827 394 827 394 394 394 394 827 827 827 394 394 394 827 827 394 394 394 394 827 394 827 394 827 394 827 394 827 394 394 394 827 827 394 394 394 827 827 827 827 827 827 827 394 394 394 827 827 394 827 827 827 394 394 394 394 82...
result:
ok Accepted
Test #21:
score: 0
Accepted
time: 284ms
memory: 3872kb
input:
979 1 2 1 1 0 1 0 1 0 0 2 0 0 0 2 1 1 0 2 1 0 0 1 1 0 2 2 2 2 0 0 1 0 1 0 0 0 2 1 1 2 0 1 1 2 1 1 2 0 0 0 1 1 2 2 2 2 2 0 1 0 2 1 1 1 1 1 1 1 0 2 1 1 0 1 0 1 0 1 0 1 1 0 1 0 2 1 1 1 1 1 0 2 2 1 1 1 1 0 0 1 0 2 0 0 2 1 1 1 1 1 1 1 0 1 0 2 2 0 1 1 1 1 1 1 1 0 1 1 1 0 1 0 1 1 1 1 1 1 1 1 0 0 1 1 1 1 1 ...
output:
0 769 828 828 828 769 828 828 828 769 828 769 828 828 769 769 769 769 828 828 769 828 769 828 769 769 828 828 769 769 769 769 828 828 828 769 828 769 828 828 769 769 828 769 828 769 828 828 769 828 769 828 769 828 828 769 828 828 828 828 769 828 769 828 769 769 769 828 828 828 828 769 828 769 769 82...
result:
ok Accepted
Test #22:
score: 0
Accepted
time: 302ms
memory: 3904kb
input:
980 2 1 0 1 0 0 1 0 0 0 2 1 0 1 0 1 1 0 1 1 1 0 2 2 1 0 0 0 1 1 1 1 1 1 0 0 0 0 1 0 0 0 2 2 0 0 1 1 1 0 1 1 0 1 0 1 0 2 2 0 1 1 2 0 1 1 1 0 2 2 0 1 1 1 1 0 2 1 1 1 0 2 1 1 2 0 0 2 1 0 1 1 1 1 2 0 1 0 2 1 0 1 1 2 1 0 0 0 1 0 1 1 2 0 1 0 1 0 0 2 1 0 1 0 0 1 1 0 1 1 0 2 1 0 1 1 1 1 1 1 2 1 1 2 2 0 0 0 ...
output:
0 825 825 825 825 534 825 534 825 534 825 534 534 825 534 825 534 825 825 825 534 825 534 534 534 534 825 825 825 534 534 534 825 825 534 534 534 534 825 534 825 534 825 534 825 534 825 534 534 534 825 825 534 534 534 825 825 825 825 825 825 825 534 534 534 825 825 534 825 825 825 534 534 534 534 82...
result:
ok Accepted
Test #23:
score: 0
Accepted
time: 309ms
memory: 3704kb
input:
981 1 2 1 1 1 1 1 1 1 0 0 1 1 2 0 1 0 1 0 1 0 1 0 1 1 2 1 1 1 0 1 1 2 1 0 1 0 0 0 2 2 0 1 0 1 0 1 1 1 0 0 2 0 2 2 1 0 0 0 2 0 0 2 0 0 1 1 1 1 1 1 2 1 0 1 1 1 1 0 1 1 1 0 2 1 0 1 0 1 1 1 0 1 1 1 0 1 1 2 2 1 0 1 1 0 1 0 1 1 1 0 1 1 2 2 1 1 0 1 0 2 2 1 0 1 0 1 1 2 1 1 2 1 1 1 0 1 0 0 1 1 1 0 0 1 0 1 0 ...
output:
0 559 826 826 826 559 826 826 826 559 826 559 826 826 559 559 559 559 826 826 559 826 559 826 559 559 826 826 559 559 559 559 826 826 826 559 826 559 826 826 559 559 826 559 826 559 826 826 559 826 559 826 559 826 826 559 826 826 826 826 559 826 559 826 559 559 559 826 826 826 826 559 826 559 559 82...
result:
ok Accepted
Test #24:
score: 0
Accepted
time: 316ms
memory: 3544kb
input:
982 2 0 1 1 1 0 0 2 2 2 0 0 2 2 1 1 0 1 1 1 0 1 0 0 0 1 0 1 1 1 0 2 0 1 1 1 0 1 1 1 0 1 0 1 0 0 1 1 2 1 1 1 1 1 0 1 0 1 0 1 1 0 1 0 1 1 2 1 0 2 0 0 1 1 1 1 1 1 2 0 1 0 1 1 1 0 1 0 2 2 1 0 1 1 0 1 1 1 1 1 1 1 1 0 2 2 1 0 0 2 2 2 1 1 1 0 0 1 1 1 1 1 0 1 0 2 2 0 1 1 1 0 2 1 0 2 1 1 2 0 1 0 1 0 2 1 0 1 ...
output:
0 823 823 823 823 109 823 109 823 109 823 109 109 823 109 823 109 823 823 823 109 823 109 109 109 109 823 823 823 109 109 109 823 823 109 109 109 109 823 109 823 109 823 109 823 109 823 109 109 109 823 823 109 109 109 823 823 823 823 823 823 823 109 109 109 823 823 109 823 823 823 109 109 109 109 82...
result:
ok Accepted
Test #25:
score: 0
Accepted
time: 334ms
memory: 3604kb
input:
983 0 0 1 1 1 1 1 1 0 2 1 0 1 1 1 0 2 1 0 1 0 1 0 1 1 1 1 1 0 1 0 1 1 0 0 0 1 1 2 1 0 0 0 1 1 1 0 2 2 2 2 1 0 2 2 1 0 1 1 1 0 1 0 1 0 2 2 1 1 0 1 1 0 0 2 1 1 2 1 1 0 1 1 1 1 0 0 1 1 2 0 1 1 1 0 2 2 1 1 2 1 1 1 0 1 1 0 1 1 1 0 1 1 1 0 1 1 1 1 1 0 0 1 1 2 1 0 1 1 2 2 2 0 1 1 0 2 2 0 1 0 1 0 2 1 1 1 0 ...
output:
0 110 824 824 824 110 824 824 824 110 824 110 824 824 110 110 110 824 824 824 110 824 110 824 110 110 824 824 110 110 110 110 824 824 824 110 824 110 824 824 110 110 824 110 824 110 824 824 110 824 110 824 110 824 824 110 824 824 824 824 110 824 110 824 110 110 110 824 824 824 824 110 824 110 110 82...
result:
ok Accepted
Test #26:
score: 0
Accepted
time: 312ms
memory: 3616kb
input:
984 2 1 0 1 1 1 1 2 1 1 0 1 1 1 0 0 1 1 1 0 2 2 2 2 1 1 2 0 0 2 1 1 2 2 1 1 2 2 1 1 1 0 2 0 1 1 1 1 2 2 1 0 2 1 0 0 1 1 2 1 1 0 1 0 0 0 1 0 0 1 0 1 1 1 1 1 1 1 0 1 0 0 1 1 0 0 0 1 0 1 1 1 0 1 1 1 1 1 1 0 0 1 1 1 0 0 1 0 1 1 2 2 1 0 1 1 1 0 2 1 1 2 2 2 1 1 1 1 1 1 2 1 0 1 0 2 0 1 1 1 1 0 0 0 1 0 0 1 ...
output:
0 821 821 821 821 107 821 107 821 107 821 107 107 821 107 821 107 821 821 821 107 821 107 107 107 107 107 821 821 107 107 107 821 821 107 107 107 107 821 107 821 107 821 107 821 107 821 107 107 107 821 821 107 107 107 821 821 821 821 821 821 821 107 107 107 821 821 107 821 821 821 107 107 107 107 82...
result:
ok Accepted
Test #27:
score: 0
Accepted
time: 303ms
memory: 3908kb
input:
985 2 1 1 2 2 1 1 1 0 1 0 1 1 2 2 0 2 0 2 1 1 2 1 1 1 1 1 0 0 1 1 1 0 2 1 1 1 1 1 1 0 1 0 2 1 0 0 1 1 1 0 1 1 2 0 1 1 0 1 0 1 1 0 0 1 0 1 0 1 0 2 2 0 1 1 2 0 2 1 0 1 0 1 1 0 2 2 0 2 1 1 1 0 1 1 0 1 1 1 1 1 0 1 0 1 0 1 1 2 0 0 0 0 2 1 0 0 0 1 1 0 2 1 1 0 0 2 1 1 1 0 1 1 1 0 1 1 1 1 2 1 0 2 0 0 1 0 1 ...
output:
0 108 822 822 822 108 822 822 822 108 822 108 822 822 108 108 108 822 822 822 108 822 108 822 108 108 822 822 108 108 108 108 822 822 822 108 822 108 822 822 108 108 822 108 822 108 822 822 108 822 108 822 108 822 822 108 822 822 822 822 108 822 108 822 108 108 108 822 822 822 822 108 822 108 108 82...
result:
ok Accepted
Test #28:
score: 0
Accepted
time: 288ms
memory: 3908kb
input:
986 1 1 2 1 1 0 0 2 1 1 1 1 1 1 1 0 2 1 1 2 1 1 0 1 0 2 1 1 0 0 2 0 0 0 0 2 1 1 2 1 0 0 1 1 1 0 1 0 0 1 0 1 1 1 0 1 1 2 1 1 0 1 0 2 2 0 1 0 0 1 0 2 1 1 2 1 0 2 0 0 1 1 2 0 0 1 1 1 1 1 0 0 0 2 0 1 1 1 1 1 1 0 0 0 1 1 1 1 2 1 0 1 1 1 1 1 0 1 1 2 1 1 1 1 2 0 2 2 1 1 2 1 1 2 1 0 0 2 2 2 2 2 1 1 1 1 2 2 ...
output:
0 819 819 819 819 118 819 118 819 118 819 118 118 819 118 819 118 819 819 819 118 819 118 118 118 118 118 819 819 118 118 118 819 819 118 118 118 118 819 118 819 118 819 118 819 118 819 118 118 118 819 819 118 118 118 819 819 819 819 819 819 819 118 118 118 819 819 118 819 819 819 118 118 118 118 81...
result:
ok Accepted
Test #29:
score: 0
Accepted
time: 332ms
memory: 3824kb
input:
987 1 0 0 1 0 1 0 1 1 1 1 2 2 2 1 0 1 1 1 1 1 1 0 0 0 2 2 0 1 1 1 0 2 1 1 1 0 1 1 2 1 0 0 2 1 0 0 1 0 1 0 1 1 0 1 0 1 1 1 0 1 1 1 1 2 1 0 1 0 1 1 2 1 1 0 2 1 1 1 0 1 0 0 1 0 2 1 0 1 0 0 1 1 0 1 0 1 1 0 1 0 0 1 1 2 1 0 1 0 2 2 1 1 0 0 1 1 1 0 1 1 2 1 0 0 2 1 1 1 1 2 0 1 0 0 1 1 2 0 2 2 0 1 0 0 1 0 0 ...
output:
0 607 820 820 820 607 820 820 820 607 820 607 820 820 607 607 607 820 820 820 607 820 607 820 607 607 820 820 607 607 607 607 820 820 820 607 820 607 820 820 607 607 820 607 820 607 820 820 607 820 607 820 607 820 820 607 820 820 820 820 607 820 607 820 607 607 607 820 820 820 820 607 820 607 607 82...
result:
ok Accepted
Test #30:
score: 0
Accepted
time: 319ms
memory: 3664kb
input:
988 0 0 0 0 0 1 1 2 0 1 0 1 0 0 0 1 1 2 1 1 1 1 0 0 1 1 1 1 1 0 0 1 1 1 0 1 1 0 1 1 0 2 0 0 1 1 1 0 0 0 0 0 1 0 1 0 2 2 2 2 2 2 0 2 2 2 0 0 1 1 1 0 1 1 0 0 0 1 1 2 1 1 1 1 1 0 1 1 0 1 1 2 1 1 1 1 2 0 2 0 1 1 2 1 1 1 1 0 0 0 2 2 1 0 2 2 2 0 1 1 2 0 2 1 1 1 0 1 0 2 2 0 1 1 0 0 0 1 1 1 0 2 1 0 0 1 0 1 ...
output:
0 817 817 817 817 392 817 392 817 392 817 392 392 817 392 817 392 817 817 817 392 817 392 392 392 392 392 817 817 392 392 392 817 817 392 392 392 392 817 392 817 392 817 392 817 392 817 392 392 392 817 817 392 392 392 817 817 817 817 817 817 817 392 392 392 817 817 392 817 817 817 392 392 392 392 81...
result:
ok Accepted
Test #31:
score: 0
Accepted
time: 321ms
memory: 3912kb
input:
989 0 1 1 1 0 0 0 0 1 1 0 2 2 1 0 0 1 0 2 0 1 0 0 1 1 0 1 1 1 0 2 1 1 2 2 2 1 0 1 1 1 0 2 1 0 0 1 0 1 1 0 2 1 1 2 1 1 1 1 1 1 1 0 1 1 0 1 0 2 0 0 2 2 0 1 1 0 1 0 2 2 1 0 1 1 2 1 0 1 1 1 1 1 0 1 1 2 2 1 1 0 0 1 1 2 0 0 0 1 1 2 0 1 0 0 2 1 1 1 1 1 1 0 0 2 0 0 1 1 2 2 1 1 1 1 1 0 1 1 1 0 0 2 1 1 1 0 0 ...
output:
0 104 818 818 818 104 818 818 818 104 818 104 818 818 104 104 104 818 818 818 104 818 104 818 104 104 818 818 104 104 104 104 818 818 818 104 818 104 818 818 104 104 818 104 818 104 818 818 104 818 104 818 104 818 818 104 818 818 818 818 104 818 104 818 104 104 104 818 818 818 818 104 818 104 104 81...
result:
ok Accepted
Test #32:
score: 0
Accepted
time: 301ms
memory: 3868kb
input:
990 1 0 1 0 1 1 0 2 2 1 0 0 0 1 0 2 0 2 1 1 2 1 1 0 0 0 1 0 2 0 2 0 1 1 1 1 1 0 0 1 1 1 0 2 1 0 2 0 2 1 0 1 1 0 1 1 1 1 0 1 0 0 1 1 2 1 1 1 1 2 0 1 1 0 2 1 0 0 1 1 1 0 1 0 2 1 1 1 0 0 1 1 2 1 1 2 1 1 1 1 0 1 1 1 0 1 0 0 1 1 2 0 1 0 1 0 1 0 1 0 2 2 0 2 1 1 2 1 0 1 0 1 1 1 0 1 1 2 0 2 0 2 1 1 1 1 1 1 ...
output:
0 815 815 815 815 101 815 101 815 101 815 101 101 815 101 815 101 815 815 815 101 815 101 101 101 101 101 815 815 101 101 101 815 815 101 101 101 101 815 101 815 101 815 101 815 101 815 101 101 101 815 815 101 101 101 815 815 815 815 815 815 815 101 101 101 815 815 101 815 815 815 101 101 101 101 81...
result:
ok Accepted
Test #33:
score: 0
Accepted
time: 346ms
memory: 3896kb
input:
991 1 1 0 1 0 0 1 1 1 0 1 0 2 0 2 2 2 1 1 1 1 2 2 1 1 1 0 2 1 0 0 0 1 0 2 1 1 1 0 0 0 1 1 2 0 0 2 0 1 0 1 1 2 0 0 2 2 2 2 1 0 1 0 2 1 1 2 0 1 0 1 0 2 1 1 2 1 0 0 1 0 2 1 1 1 0 2 1 1 1 0 2 1 0 0 1 0 0 2 2 2 1 1 2 2 1 1 2 1 0 1 0 0 2 2 1 1 2 0 0 1 0 1 1 1 0 2 1 1 0 1 1 1 0 1 1 2 0 1 1 1 1 0 1 0 2 0 1 ...
output:
0 102 816 816 816 102 816 816 816 102 816 102 816 816 102 102 102 816 816 816 102 816 102 816 102 102 816 816 102 102 102 102 816 816 816 102 816 102 816 816 102 102 816 102 816 102 816 816 102 816 102 816 102 816 816 102 816 816 816 816 102 816 102 816 102 102 102 816 816 816 816 102 816 102 102 81...
result:
ok Accepted
Test #34:
score: 0
Accepted
time: 322ms
memory: 3548kb
input:
992 1 1 1 1 1 1 1 1 2 1 1 1 0 2 0 2 2 1 1 1 1 1 0 1 0 1 1 2 2 1 1 0 2 0 1 1 2 0 1 1 0 2 1 0 1 0 1 0 0 0 2 2 1 1 2 0 2 1 0 1 1 0 1 1 2 2 2 2 1 1 1 0 1 0 0 2 1 1 2 1 1 2 0 0 1 1 1 1 2 1 1 2 1 0 1 0 0 1 1 0 1 0 2 1 1 2 2 1 1 1 0 2 1 0 1 0 1 0 1 1 1 1 2 1 1 0 1 1 1 1 1 1 1 0 0 2 2 1 1 0 1 0 1 1 1 0 1 0 ...
output:
0 813 813 813 813 762 813 762 813 762 813 762 762 813 762 813 762 813 813 813 762 813 762 762 762 762 762 813 813 762 762 762 813 813 762 762 762 762 813 762 813 762 813 762 813 762 813 762 762 762 813 813 762 762 762 813 813 813 813 813 813 813 762 762 762 813 813 762 813 813 813 762 762 762 762 81...
result:
ok Accepted
Test #35:
score: 0
Accepted
time: 324ms
memory: 3576kb
input:
993 2 1 0 1 0 1 1 1 0 1 0 0 1 0 1 1 0 1 1 1 1 1 0 0 1 0 1 0 0 1 1 2 2 1 1 2 1 1 1 1 1 0 1 0 1 0 1 0 1 1 2 1 1 1 0 0 0 2 1 0 0 1 1 1 1 0 1 1 1 0 0 1 0 0 2 2 1 1 0 0 1 0 2 2 1 0 0 2 1 1 0 2 1 0 1 0 2 0 2 1 0 2 1 1 1 1 0 1 0 1 1 2 1 1 0 1 0 1 1 2 1 0 2 1 0 2 2 2 0 1 0 2 1 1 0 2 1 0 1 0 1 1 1 0 0 0 1 1 ...
output:
0 100 814 814 814 100 814 814 814 100 814 100 814 814 100 100 100 814 814 814 100 814 100 814 100 100 814 814 100 100 100 100 814 814 814 100 814 100 814 814 100 100 814 100 814 100 814 814 100 814 100 814 100 814 814 100 814 814 814 814 100 814 100 814 100 100 100 814 814 814 814 100 814 100 100 81...
result:
ok Accepted
Test #36:
score: 0
Accepted
time: 309ms
memory: 3604kb
input:
994 0 2 1 0 0 1 1 1 0 0 1 1 0 2 1 0 1 1 1 1 1 0 1 0 0 0 1 0 1 1 0 2 2 0 1 1 0 2 0 0 2 1 0 1 0 1 0 0 0 2 1 1 0 0 1 1 2 1 1 2 0 1 1 1 0 1 1 0 2 0 2 1 0 0 0 0 1 1 1 0 1 1 1 0 1 1 1 0 1 1 1 0 1 0 1 0 1 0 1 1 1 0 2 2 0 1 1 2 1 1 2 0 0 0 2 0 0 0 2 1 0 1 0 1 1 1 1 2 0 2 2 0 1 1 0 2 2 2 0 1 1 1 1 1 0 0 1 1 ...
output:
0 811 811 811 811 190 811 190 811 190 811 190 190 811 190 811 190 811 811 811 190 811 190 190 190 190 190 811 811 190 190 190 811 811 190 190 190 190 811 190 811 190 811 190 811 190 811 190 190 190 811 811 190 190 190 811 811 811 811 811 811 811 190 190 190 811 811 190 811 811 811 190 190 190 190 81...
result:
ok Accepted
Test #37:
score: 0
Accepted
time: 311ms
memory: 3664kb
input:
995 1 2 1 1 2 1 0 1 0 1 1 1 1 1 1 1 0 1 1 2 1 1 2 0 1 1 1 1 1 0 0 2 1 0 2 1 1 1 1 2 1 0 1 0 1 0 2 1 1 1 0 1 0 1 1 2 0 1 1 1 0 1 0 0 1 0 0 2 1 0 0 2 1 1 1 0 0 1 1 0 0 1 1 2 0 1 1 1 0 1 0 0 2 0 1 1 1 0 0 1 0 1 1 2 1 0 1 1 0 0 2 2 0 1 1 2 0 0 1 0 1 1 1 0 0 0 0 1 1 2 1 1 1 1 1 1 0 2 0 1 0 0 2 0 2 1 1 1 ...
output:
0 531 812 812 812 531 812 812 812 531 812 531 812 812 531 531 531 812 812 812 531 812 531 812 531 531 812 812 531 531 531 531 812 812 812 531 812 531 812 812 531 531 812 531 812 531 812 812 531 812 531 812 531 812 812 531 812 812 812 812 531 812 531 812 531 531 531 812 812 812 812 531 812 531 531 81...
result:
ok Accepted
Test #38:
score: 0
Accepted
time: 317ms
memory: 3828kb
input:
996 2 2 0 0 2 2 2 2 2 2 1 1 1 0 0 1 0 1 0 0 1 0 1 1 0 1 0 1 1 0 1 1 1 0 1 1 1 0 1 1 0 0 1 1 0 1 1 2 1 1 0 1 0 1 1 0 0 2 0 1 1 1 0 1 1 2 1 0 1 1 2 2 1 1 2 0 0 2 2 0 0 2 1 1 1 0 0 0 1 1 2 2 1 1 0 2 0 1 0 1 1 0 1 0 2 1 0 1 1 1 1 1 0 2 0 2 1 0 0 1 1 1 1 2 2 2 1 1 0 1 1 2 2 1 0 0 2 1 1 1 1 1 1 1 0 1 1 2 ...
output:
0 809 809 809 809 676 809 676 809 676 809 676 676 809 676 809 676 809 809 809 676 809 676 676 676 676 676 809 809 676 676 676 809 809 676 676 676 676 809 676 809 676 809 676 809 676 809 676 676 676 809 809 676 676 676 809 809 809 809 809 809 809 676 676 676 809 809 676 809 809 809 676 676 676 676 80...
result:
ok Accepted
Test #39:
score: 0
Accepted
time: 309ms
memory: 3604kb
input:
997 1 1 1 1 0 1 0 0 2 0 2 2 0 2 1 0 2 1 0 0 1 1 0 0 0 0 2 1 1 1 1 1 1 0 0 1 0 0 1 1 0 2 1 0 0 0 1 1 2 0 1 1 0 2 1 1 2 1 0 1 1 2 1 0 0 1 0 2 0 1 1 1 1 2 1 1 1 0 0 0 1 0 1 1 1 0 1 0 1 1 0 2 1 0 0 0 0 1 1 0 1 0 1 1 0 2 1 0 1 0 1 0 2 2 1 1 1 1 1 1 1 1 2 2 1 1 0 1 0 0 1 0 0 1 0 1 1 0 1 0 2 1 1 1 0 2 1 1 ...
output:
0 669 810 810 810 669 810 810 810 810 810 669 810 810 669 669 669 810 810 810 669 810 669 810 669 669 810 810 669 669 669 669 810 810 810 669 810 669 810 810 669 669 810 669 810 669 810 810 669 810 669 810 669 810 810 669 810 810 810 810 669 810 669 810 669 669 669 810 810 810 810 669 810 669 669 81...
result:
ok Accepted
Test #40:
score: 0
Accepted
time: 334ms
memory: 3656kb
input:
998 1 1 0 1 0 2 1 1 1 1 1 0 2 1 0 1 1 2 0 0 1 0 2 0 0 1 0 2 0 1 0 0 1 1 1 1 0 0 1 0 1 0 1 1 1 0 1 1 0 2 1 1 1 0 0 0 1 0 1 1 0 0 2 0 0 2 2 2 1 0 1 1 1 0 2 0 1 0 1 0 2 2 1 0 2 1 0 2 1 0 2 1 0 2 0 0 0 2 1 0 1 0 0 2 0 1 1 1 0 0 2 2 2 0 1 1 2 1 1 0 1 1 2 1 1 2 1 1 1 0 0 0 2 2 1 0 1 1 1 0 0 0 0 1 1 1 0 2 ...
output:
0 807 807 807 807 326 807 326 807 326 807 326 326 807 326 807 326 807 807 807 326 807 326 326 326 326 326 807 807 326 326 326 807 807 326 326 326 326 807 326 807 326 807 326 807 326 807 326 326 326 807 807 326 326 326 807 807 807 807 807 807 807 326 326 326 807 807 326 807 807 807 326 326 326 326 80...
result:
ok Accepted
Test #41:
score: 0
Accepted
time: 321ms
memory: 3708kb
input:
999 0 1 0 1 1 1 0 0 0 1 0 0 1 0 1 1 0 1 1 0 0 0 0 0 1 1 1 1 1 1 1 0 2 1 0 1 0 0 2 1 0 1 0 2 1 0 2 2 1 0 2 1 0 1 0 2 0 0 0 0 1 1 2 0 2 0 1 1 2 1 0 1 1 1 0 1 1 1 1 1 1 0 0 2 2 2 1 0 1 1 1 0 1 1 2 1 1 1 1 2 1 1 1 0 1 1 2 1 0 1 0 1 1 1 1 2 0 0 1 0 2 2 0 1 1 0 1 0 1 1 1 1 2 0 2 0 1 0 1 1 1 1 1 0 1 0 2 1 ...
output:
0 901 808 808 808 901 808 808 808 808 808 901 808 808 901 901 901 808 808 808 901 808 901 808 901 901 808 808 901 901 901 901 808 808 808 901 808 901 808 808 901 901 808 901 808 901 808 808 901 808 901 808 901 808 808 901 808 808 808 808 901 808 901 808 901 901 901 808 808 808 808 901 808 901 901 80...
result:
ok Accepted
Extra Test:
score: 0
Extra Test Passed