QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#625003 | #9432. Permutation | ucup-team4153# | AC ✓ | 286ms | 3940kb | C++20 | 2.6kb | 2024-10-09 17:07:24 | 2024-10-09 17:07:24 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
const int N = 1e3 + 7;
int n;
vector<int> G[N];
int res[N], bel[N], a[N];
int cnt=0;
int ask(int l, int r, int x, int y) {
int mid = (l + r) >> 1;
int ans = 0;
cnt++;
if(cnt==6667)assert(0);
cout << "0 ";
// for (int i = 1; i <= mid; i++)ans += (a[i] == x);
// for (int i = mid + 1; i <= n; i++)ans += (a[i] == y);
for (int i = 1; i <= mid; i++)cout << x << " ";
for (int i = mid + 1; i <= n; i++)cout << y << " ";
cout << endl;
cin >> ans;
// cout << l << " " << r << " " << x << " " << y << " " << ans << "\n";
return ans;
}
void dfs(int u) {
for (auto v: G[u]) {
if (bel[v] != -1)continue;
bel[v] = bel[u];
dfs(v);
}
}
void solve(int l, int r, vector<int> x) {
if (l == r) {
res[l] = x.back();
return;
}
random_shuffle(x.begin(), x.end());
vector<int> y = x;
int mid = (l + r) >> 1;
int len1 = mid - l + 1, len2 = r - mid;
for (auto v: x) {
G[v].clear();
bel[v] = -1;
}
while (y.size()) {
int siz = y.size();
vector<int> nxt;
for (int i = 0; i < siz - 1; i += 2) {
int ans = ask(l, r, y[i], y[i + 1]);
if (ans == 0) {
bel[y[i + 1]] = 0;
bel[y[i]] = 1;
// cout << y[i] << " " << y[i + 1] << "\n";
len1--;
len2--;
} else if (ans == 2) {
bel[y[i + 1]] = 1;
bel[y[i]] = 0;
len2--;
len1--;
} else {
G[y[i]].push_back(y[i + 1]);
nxt.push_back(y[i]);
}
}
if (siz & 1) {
if (len1 & 1)bel[y.back()] = 0;
else bel[y.back()] = 1;
}
len1 /= 2;
len2 /= 2;
swap(nxt, y);
}
for (auto v: x) {
if (bel[v] != -1)dfs(v);
}
vector<int> L, R;
for (auto v: x) {
if (bel[v] == 0)L.push_back(v);
else R.push_back(v);
}
// for (int i = 1; i <= n; i++)cout << bel[i] << " ";
// cout << "\n";
solve(l, mid, L);
solve(mid + 1, r, R);
}
signed main() {
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
cin >> n;
vector<int> x;
// for (int i = 1; i <= n; i++)cin >> a[i];
for (int i = 1; i <= n; i++)x.push_back(i);
solve(1, n, x);
cout << "1 ";
for (int i = 1; i <= n; i++)cout << res[i] << " ";
cout << endl;
return 0;
}
详细
Test #1:
score: 100
Accepted
time: 1ms
memory: 3804kb
input:
5 0 1 1 2 2
output:
0 5 5 5 4 4 0 2 2 2 3 3 0 4 4 3 3 3 0 3 4 4 4 4 0 1 1 1 1 5 1 3 4 2 1 5
result:
ok Accepted
Test #2:
score: 0
Accepted
time: 286ms
memory: 3708kb
input:
1000 1 1 1 2 1 0 1 1 2 0 1 1 0 1 2 2 1 1 2 1 2 0 1 2 0 2 2 2 1 2 0 1 2 0 1 0 1 1 1 1 2 1 1 1 2 2 2 2 2 1 0 1 1 2 0 1 0 1 1 0 0 1 1 0 0 1 0 0 1 2 0 0 0 2 2 1 1 1 0 0 1 1 0 2 1 1 2 1 0 1 1 1 1 2 1 1 1 2 1 1 1 1 1 0 0 2 1 1 1 1 2 0 1 2 1 1 2 0 0 1 0 0 0 0 1 1 1 2 2 1 1 1 1 1 0 0 0 1 1 1 1 1 1 0 1 0 1 1...
output:
0 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 11...
result:
ok Accepted
Test #3:
score: 0
Accepted
time: 1ms
memory: 3640kb
input:
1
output:
1 1
result:
ok Accepted
Test #4:
score: 0
Accepted
time: 1ms
memory: 3636kb
input:
2 0
output:
0 1 2 1 2 1
result:
ok Accepted
Test #5:
score: 0
Accepted
time: 0ms
memory: 3676kb
input:
3 1 0
output:
0 1 1 3 0 1 3 3 1 3 1 2
result:
ok Accepted
Test #6:
score: 0
Accepted
time: 1ms
memory: 3620kb
input:
4 0 0 0 0
output:
0 1 1 4 4 0 2 2 3 3 0 4 3 3 3 0 1 1 1 2 1 3 4 2 1
result:
ok Accepted
Test #7:
score: 0
Accepted
time: 1ms
memory: 3524kb
input:
6 0 1 1 2 1 2 0 2
output:
0 5 5 5 4 4 4 0 2 2 2 3 3 3 0 1 1 1 6 6 6 0 2 2 2 1 1 1 0 4 4 3 3 3 3 0 3 4 4 4 4 4 0 5 5 5 5 5 6 0 1 1 1 1 6 6 1 3 4 2 1 6 5
result:
ok Accepted
Test #8:
score: 0
Accepted
time: 0ms
memory: 3580kb
input:
7 1 1 2 0 0 2 2 2 2 0
output:
0 5 5 5 5 4 4 4 0 2 2 2 2 7 7 7 0 1 1 1 1 6 6 6 0 5 5 5 5 2 2 2 0 1 1 3 3 3 3 3 0 7 7 2 2 2 2 2 0 3 7 7 7 7 7 7 0 2 2 2 1 1 1 1 0 5 5 5 5 5 5 4 0 5 5 5 5 5 6 6 1 3 7 2 1 6 5 4
result:
ok Accepted
Test #9:
score: 0
Accepted
time: 1ms
memory: 3808kb
input:
8 1 0 2 1 0 2 0 0 2 1 1 0 2 0
output:
0 5 5 5 5 4 4 4 4 0 8 8 8 8 7 7 7 7 0 1 1 1 1 6 6 6 6 0 3 3 3 3 2 2 2 2 0 5 5 5 5 3 3 3 3 0 3 3 2 2 2 2 2 2 0 1 1 7 7 7 7 7 7 0 7 3 3 3 3 3 3 3 0 2 2 2 1 1 1 1 1 0 4 4 4 4 4 4 8 8 0 5 5 5 5 5 5 6 6 0 4 4 4 4 4 4 5 5 0 6 6 6 6 6 5 5 5 0 8 8 8 8 8 8 8 4 1 3 7 2 1 6 5 4 8
result:
ok Accepted
Test #10:
score: 0
Accepted
time: 1ms
memory: 3584kb
input:
9 1 0 2 1 0 0 2 2 0 2 0 2 0 0
output:
0 5 5 5 5 5 4 4 4 4 0 8 8 8 8 8 9 9 9 9 0 1 1 1 1 1 6 6 6 6 0 3 3 3 3 3 2 2 2 2 0 5 5 5 5 5 3 3 3 3 0 9 9 9 3 3 3 3 3 3 0 7 7 7 1 1 1 1 1 1 0 7 7 2 2 2 2 2 2 2 0 7 3 3 3 3 3 3 3 3 0 1 1 1 1 9 9 9 9 9 0 6 6 6 6 6 6 6 5 5 0 4 4 4 4 4 4 4 8 8 0 4 4 4 4 4 4 5 5 5 0 6 6 6 6 6 6 6 6 8 1 3 7 ...
result:
ok Accepted
Test #11:
score: 0
Accepted
time: 1ms
memory: 3652kb
input:
10 1 0 2 2 1 0 2 1 0 0 0 1 1 0 0 2 0
output:
0 5 5 5 5 5 4 4 4 4 4 0 8 8 8 8 8 9 9 9 9 9 0 1 1 1 1 1 6 6 6 6 6 0 3 3 3 3 3 2 2 2 2 2 0 7 7 7 7 7 10 10 10 10 10 0 5 5 5 5 5 7 7 7 7 7 0 10 10 10 1 1 1 1 1 1 1 0 3 3 3 7 7 7 7 7 7 7 0 10 10 3 3 3 3 3 3 3 3 0 7 3 3 3 3 3 3 3 3 3 0 9 9 9 9 1 1 1 1 1 1 0 6 6 6 6 6 6 6 6 2 2 0 5 5 5 5 5 5 ...
result:
ok Accepted
Test #12:
score: 0
Accepted
time: 1ms
memory: 3880kb
input:
11 2 0 2 2 1 1 2 1 0 0 0 2 2 2 1 2 2 2
output:
0 5 5 5 5 5 5 11 11 11 11 11 0 8 8 8 8 8 8 9 9 9 9 9 0 1 1 1 1 1 1 6 6 6 6 6 0 3 3 3 3 3 3 2 2 2 2 2 0 7 7 7 7 7 7 10 10 10 10 10 0 9 9 9 1 1 1 1 1 1 1 1 0 3 3 3 5 5 5 5 5 5 5 5 0 7 7 7 10 10 10 10 10 10 10 10 0 9 9 9 7 7 7 7 7 7 7 7 0 10 10 3 3 3 3 3 3 3 3 3 0 7 3 3 3 3 3 3 3 3 3 3 0 1 1...
result:
ok Accepted
Test #13:
score: 0
Accepted
time: 0ms
memory: 3572kb
input:
12 2 0 2 2 1 1 2 1 0 1 0 1 0 2 2 1 0 1 2 1 2 2 0
output:
0 5 5 5 5 5 5 11 11 11 11 11 11 0 12 12 12 12 12 12 9 9 9 9 9 9 0 1 1 1 1 1 1 6 6 6 6 6 6 0 3 3 3 3 3 3 2 2 2 2 2 2 0 7 7 7 7 7 7 10 10 10 10 10 10 0 4 4 4 4 4 4 8 8 8 8 8 8 0 7 7 7 7 7 7 4 4 4 4 4 4 0 5 5 5 9 9 9 9 9 9 9 9 9 0 1 1 1 7 7 7 7 7 7 7 7 7 0 10 10 10 3 3 3 3 3 3 3 3 3 0 5 5 5 1...
result:
ok Accepted
Test #14:
score: 0
Accepted
time: 1ms
memory: 3568kb
input:
13 2 0 2 1 1 2 0 1 0 1 0 0 2 0 0 0 0 2 2 2 2 2 2 2
output:
0 5 5 5 5 5 5 5 11 11 11 11 11 11 0 12 12 12 12 12 12 12 13 13 13 13 13 13 0 1 1 1 1 1 1 1 6 6 6 6 6 6 0 3 3 3 3 3 3 3 2 2 2 2 2 2 0 7 7 7 7 7 7 7 10 10 10 10 10 10 0 4 4 4 4 4 4 4 8 8 8 8 8 8 0 3 3 3 3 3 3 3 7 7 7 7 7 7 0 4 4 4 4 9 9 9 9 9 9 9 9 9 0 5 5 5 5 7 7 7 7 7 7 7 7 7 0 1 1 1 1 13 1...
result:
ok Accepted
Test #15:
score: 0
Accepted
time: 1ms
memory: 3864kb
input:
14 1 0 2 2 1 2 2 0 0 1 1 0 2 0 0 0 2 0 1 2 2 2 2 0 2 1 0
output:
0 5 5 5 5 5 5 5 11 11 11 11 11 11 11 0 12 12 12 12 12 12 12 13 13 13 13 13 13 13 0 1 1 1 1 1 1 1 6 6 6 6 6 6 6 0 14 14 14 14 14 14 14 2 2 2 2 2 2 2 0 7 7 7 7 7 7 7 10 10 10 10 10 10 10 0 4 4 4 4 4 4 4 8 8 8 8 8 8 8 0 9 9 9 9 9 9 9 3 3 3 3 3 3 3 0 5 5 5 5 5 5 5 7 7 7 7 7 7 7 0 4 4 4 4 1 1 1 1...
result:
ok Accepted
Test #16:
score: 0
Accepted
time: 1ms
memory: 3860kb
input:
15 0 0 2 1 1 2 2 0 1 0 1 2 2 0 0 0 2 0 2 0 2 2 0 1 0 2 0 2 2 0
output:
0 5 5 5 5 5 5 5 5 11 11 11 11 11 11 11 0 12 12 12 12 12 12 12 12 13 13 13 13 13 13 13 0 15 15 15 15 15 15 15 15 6 6 6 6 6 6 6 0 14 14 14 14 14 14 14 14 2 2 2 2 2 2 2 0 7 7 7 7 7 7 7 7 10 10 10 10 10 10 10 0 4 4 4 4 4 4 4 4 8 8 8 8 8 8 8 0 9 9 9 9 9 9 9 9 3 3 3 3 3 3 3 0 14 14 14 14 14 14 14 1...
result:
ok Accepted
Test #17:
score: 0
Accepted
time: 250ms
memory: 3644kb
input:
975 1 1 1 2 2 0 1 1 2 0 1 1 0 1 2 2 1 1 2 1 2 0 1 2 0 2 2 2 1 2 0 1 2 0 1 0 1 1 1 1 2 1 1 1 2 2 2 2 2 1 0 1 1 2 0 1 0 1 1 0 0 1 1 0 0 1 0 0 1 2 0 0 0 2 2 1 1 1 0 0 1 1 0 2 1 1 2 1 0 1 1 1 1 2 1 2 1 2 1 1 2 1 1 0 1 2 1 1 1 1 2 1 1 2 1 1 2 0 0 1 0 0 0 0 2 1 1 1 2 1 1 1 1 1 0 0 0 1 1 1 1 1 1 0 1 0 1 1 ...
output:
0 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 11...
result:
ok Accepted
Test #18:
score: 0
Accepted
time: 252ms
memory: 3940kb
input:
976 1 1 1 2 2 0 1 1 2 0 1 1 0 1 2 2 1 1 2 1 2 0 1 2 0 2 2 2 1 2 0 1 2 0 1 0 1 1 1 1 2 1 1 1 2 2 2 2 2 1 0 1 1 2 0 1 0 1 1 0 0 1 1 0 0 1 0 0 1 2 0 0 0 2 2 1 1 1 0 0 1 1 0 2 1 1 2 1 0 1 1 1 1 2 1 2 1 2 1 1 2 1 1 0 1 2 1 1 1 1 2 1 1 2 1 1 2 0 0 1 0 0 0 0 2 1 1 1 2 1 1 1 1 1 0 0 0 1 1 1 1 1 1 0 1 0 1 1 ...
output:
0 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 11...
result:
ok Accepted
Test #19:
score: 0
Accepted
time: 230ms
memory: 3652kb
input:
977 1 1 1 2 2 0 1 1 2 0 1 1 0 1 2 2 1 1 2 1 2 0 1 2 0 2 2 2 1 2 0 1 2 0 1 0 1 1 1 1 2 1 1 1 2 2 2 2 2 1 0 1 1 2 0 1 0 1 1 0 0 1 1 0 0 1 0 0 1 2 0 0 0 2 2 1 1 1 0 0 1 1 0 2 1 1 2 1 0 1 1 1 1 2 1 2 1 2 1 1 2 1 1 0 1 2 1 1 1 1 2 1 1 2 1 1 2 0 0 1 0 0 0 0 1 1 1 2 2 1 1 1 1 1 0 0 0 1 1 1 1 1 1 0 1 0 1 1 ...
output:
0 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 11...
result:
ok Accepted
Test #20:
score: 0
Accepted
time: 259ms
memory: 3652kb
input:
978 1 1 1 2 2 0 1 1 2 0 1 1 0 1 2 2 1 1 2 1 2 0 1 2 0 2 2 2 1 2 0 1 2 0 1 0 1 1 1 1 2 1 1 1 2 2 2 2 2 1 0 1 1 2 0 1 0 1 1 0 0 1 1 0 0 1 0 0 1 2 0 0 0 2 2 1 1 1 0 0 1 1 0 2 1 1 2 1 0 1 1 1 1 2 1 2 1 2 1 1 2 1 1 0 1 2 1 1 1 1 2 1 1 2 1 1 2 0 0 1 0 0 0 0 1 1 1 2 2 1 1 1 1 1 0 0 0 1 1 1 1 1 1 0 1 0 1 1 ...
output:
0 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 11...
result:
ok Accepted
Test #21:
score: 0
Accepted
time: 257ms
memory: 3644kb
input:
979 1 1 1 2 2 0 1 1 2 0 1 1 0 1 2 2 1 1 2 1 2 0 1 2 0 2 2 2 1 2 0 1 2 0 1 0 1 1 1 1 2 1 1 1 2 2 2 2 2 1 0 1 1 2 0 1 0 1 1 0 0 1 1 0 0 1 0 0 1 2 0 0 0 2 2 1 1 1 0 0 1 1 0 2 1 1 2 1 0 1 1 1 1 2 1 2 1 2 1 1 2 1 1 0 1 2 1 1 1 1 2 1 1 2 1 1 2 0 0 1 0 0 0 0 1 1 1 2 2 1 1 1 1 1 0 0 0 1 1 1 1 1 1 0 1 0 1 1 ...
output:
0 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 11...
result:
ok Accepted
Test #22:
score: 0
Accepted
time: 259ms
memory: 3756kb
input:
980 1 1 1 2 2 0 1 1 2 0 1 1 0 1 2 2 1 1 2 1 2 0 1 2 0 2 2 2 1 2 0 1 2 0 1 0 1 1 1 1 2 1 1 1 2 2 2 2 2 1 0 1 1 2 0 1 0 1 1 0 0 1 1 0 0 1 0 0 1 2 0 0 0 2 2 1 1 1 0 0 1 1 0 2 1 1 2 1 0 1 1 1 1 2 1 2 1 2 1 1 2 1 1 0 1 2 1 1 1 1 2 1 1 2 1 1 2 0 0 1 0 0 0 0 1 1 1 2 2 1 1 1 1 1 0 0 0 1 1 1 1 1 1 0 1 0 1 1 ...
output:
0 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 11...
result:
ok Accepted
Test #23:
score: 0
Accepted
time: 271ms
memory: 3720kb
input:
981 1 1 1 2 2 0 1 1 2 0 1 1 0 1 2 2 1 1 2 1 2 0 1 2 0 2 2 2 1 2 0 1 2 0 1 0 1 1 1 1 2 1 1 1 2 2 2 2 2 1 0 1 1 2 0 1 0 1 1 0 0 1 1 0 0 1 0 0 1 2 0 0 0 2 2 1 1 1 0 0 1 1 0 2 1 1 2 1 0 1 1 1 1 2 1 2 1 2 1 1 1 1 1 0 0 2 1 1 1 1 2 1 1 2 1 1 2 0 0 1 0 0 0 0 1 1 1 2 2 1 1 1 1 1 0 0 0 1 1 1 1 1 1 0 1 0 1 1 ...
output:
0 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 11...
result:
ok Accepted
Test #24:
score: 0
Accepted
time: 264ms
memory: 3644kb
input:
982 1 1 1 2 2 0 1 1 2 0 1 1 0 1 2 2 1 1 2 1 2 0 1 2 0 2 2 2 1 2 0 1 2 0 1 0 1 1 1 1 2 1 1 1 2 2 2 2 2 1 0 1 1 2 0 1 0 1 1 0 0 1 1 0 0 1 0 0 1 2 0 0 0 2 2 1 1 1 0 0 1 1 0 2 1 1 2 1 0 1 1 1 1 2 1 2 1 2 1 1 1 1 1 0 0 2 1 1 1 1 2 1 1 2 1 1 2 0 0 1 0 0 0 0 1 1 1 2 2 1 1 1 1 1 0 0 0 1 1 1 1 1 1 0 1 0 1 1 ...
output:
0 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 11...
result:
ok Accepted
Test #25:
score: 0
Accepted
time: 249ms
memory: 3696kb
input:
983 1 1 1 2 2 0 1 1 2 0 1 1 0 1 2 2 1 1 2 1 2 0 1 2 0 2 2 2 1 2 0 1 2 0 1 0 1 1 1 1 2 1 1 1 2 2 2 2 2 1 0 1 1 2 0 1 0 1 1 0 0 1 1 0 0 1 0 0 1 2 0 0 0 2 2 1 1 1 0 0 1 1 0 2 1 1 2 1 0 1 1 1 1 2 1 2 1 2 1 1 1 1 1 0 0 2 1 1 1 1 2 1 1 2 1 1 2 0 0 1 0 0 0 0 1 1 1 2 2 1 1 1 1 1 0 0 0 1 1 1 1 1 1 0 1 0 1 1 ...
output:
0 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 11...
result:
ok Accepted
Test #26:
score: 0
Accepted
time: 246ms
memory: 3644kb
input:
984 1 1 1 2 2 0 1 1 2 0 1 1 0 1 2 2 1 1 2 1 2 0 1 2 0 2 2 2 1 2 0 1 2 0 1 0 1 1 1 1 2 1 1 1 2 2 2 2 2 1 0 1 1 2 0 1 0 1 1 0 0 1 1 0 0 1 0 0 1 2 0 0 0 2 2 1 1 1 0 0 1 1 0 2 1 1 2 1 0 1 1 1 1 2 1 2 1 2 1 1 1 1 1 0 0 2 1 1 1 1 2 1 1 2 1 1 2 0 0 1 0 0 0 0 1 1 1 2 2 1 1 1 1 1 0 0 0 1 1 1 1 1 1 0 1 0 1 1 ...
output:
0 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 11...
result:
ok Accepted
Test #27:
score: 0
Accepted
time: 257ms
memory: 3884kb
input:
985 1 1 1 2 2 0 1 1 2 0 1 1 0 1 2 2 1 1 2 1 2 0 1 2 0 2 2 2 1 2 0 1 2 0 1 0 1 1 1 1 2 1 1 1 2 2 2 2 2 1 0 1 1 2 0 1 0 1 1 0 0 1 1 0 0 1 0 0 1 2 0 0 0 2 2 1 1 1 0 0 1 1 0 2 1 1 2 1 0 1 1 1 1 2 1 2 1 2 1 1 1 1 1 0 0 2 1 1 1 1 2 1 1 2 1 1 2 0 0 1 0 0 0 0 1 1 1 2 2 1 1 1 1 1 0 0 0 1 1 1 1 1 1 0 1 0 1 1 ...
output:
0 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 11...
result:
ok Accepted
Test #28:
score: 0
Accepted
time: 261ms
memory: 3728kb
input:
986 1 1 1 2 2 0 1 1 2 0 1 1 0 1 2 2 1 1 2 1 2 0 1 2 0 2 2 2 1 2 0 1 2 0 1 0 1 1 1 1 2 1 1 1 2 2 2 2 2 1 0 1 1 2 0 1 0 1 1 0 0 1 1 0 0 1 0 0 1 2 0 0 0 2 2 1 1 1 0 0 1 1 0 2 1 1 2 1 0 1 1 1 1 2 1 2 1 2 1 1 1 1 1 0 0 2 1 1 1 1 2 1 1 2 1 1 2 0 0 1 0 0 0 0 1 1 1 2 2 1 1 1 1 1 0 0 0 1 1 1 1 1 1 0 1 0 1 1 ...
output:
0 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 11...
result:
ok Accepted
Test #29:
score: 0
Accepted
time: 260ms
memory: 3600kb
input:
987 1 1 1 2 2 0 1 1 2 0 1 1 0 1 2 2 1 1 2 1 2 0 1 2 0 2 2 2 1 2 0 1 2 0 1 0 1 1 1 1 2 1 1 1 2 2 2 2 2 1 0 1 1 2 0 1 0 1 1 0 0 1 1 0 0 1 0 0 1 2 0 0 0 2 2 1 1 1 0 0 1 1 0 2 1 1 2 1 0 1 1 1 1 2 1 1 1 2 1 1 1 1 1 0 0 2 1 1 1 1 2 1 1 2 1 1 2 0 0 1 0 0 0 0 1 1 1 2 2 1 1 1 1 1 0 0 0 1 1 1 1 1 1 0 1 0 1 1 ...
output:
0 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 11...
result:
ok Accepted
Test #30:
score: 0
Accepted
time: 267ms
memory: 3712kb
input:
988 1 1 1 2 2 0 1 1 2 0 1 1 0 1 2 2 1 1 2 1 2 0 1 2 0 2 2 2 1 2 0 1 2 0 1 0 1 1 1 1 2 1 1 1 2 2 2 2 2 1 0 1 1 2 0 1 0 1 1 0 0 1 1 0 0 1 0 0 1 2 0 0 0 2 2 1 1 1 0 0 1 1 0 2 1 1 2 1 0 1 1 1 1 2 1 1 1 2 1 1 1 1 1 0 0 2 1 1 1 1 2 1 1 2 1 1 2 0 0 1 0 0 0 0 1 1 1 2 2 1 1 1 1 1 0 0 0 1 1 1 1 1 1 0 1 0 1 1 ...
output:
0 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 11...
result:
ok Accepted
Test #31:
score: 0
Accepted
time: 251ms
memory: 3648kb
input:
989 1 1 1 2 1 0 1 1 2 0 1 1 0 1 2 2 1 1 2 1 2 0 1 2 0 2 2 2 1 2 0 1 2 0 1 0 1 1 1 1 2 1 1 1 2 2 2 2 2 1 0 1 1 2 0 1 0 1 1 0 0 1 1 0 0 1 0 0 1 2 0 0 0 2 2 1 1 1 0 0 1 1 0 2 1 1 2 1 0 1 1 1 1 2 1 1 1 2 1 1 1 1 1 0 0 2 1 1 1 1 2 0 1 2 1 1 2 0 0 1 0 0 0 0 1 1 1 2 2 1 1 1 1 1 0 0 0 1 1 1 1 1 1 0 1 0 1 1 ...
output:
0 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 11...
result:
ok Accepted
Test #32:
score: 0
Accepted
time: 269ms
memory: 3936kb
input:
990 1 1 1 2 1 0 1 1 2 0 1 1 0 1 2 2 1 1 2 1 2 0 1 2 0 2 2 2 1 2 0 1 2 0 1 0 1 1 1 1 2 1 1 1 2 2 2 2 2 1 0 1 1 2 0 1 0 1 1 0 0 1 1 0 0 1 0 0 1 2 0 0 0 2 2 1 1 1 0 0 1 1 0 2 1 1 2 1 0 1 1 1 1 2 1 1 1 2 1 1 1 1 1 0 0 2 1 1 1 1 2 0 1 2 1 1 2 0 0 1 0 0 0 0 1 1 1 2 2 1 1 1 1 1 0 0 0 1 1 1 1 1 1 0 1 0 1 1 ...
output:
0 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 11...
result:
ok Accepted
Test #33:
score: 0
Accepted
time: 269ms
memory: 3872kb
input:
991 1 1 1 2 1 0 1 1 2 0 1 1 0 1 2 2 1 1 2 1 2 0 1 2 0 2 2 2 1 2 0 1 2 0 1 0 1 1 1 1 2 1 1 1 2 2 2 2 2 1 0 1 1 2 0 1 0 1 1 0 0 1 1 0 0 1 0 0 1 2 0 0 0 2 2 1 1 1 0 0 1 1 0 2 1 1 2 1 0 1 1 1 1 2 1 1 1 2 1 1 1 1 1 0 0 2 1 1 1 1 2 0 1 2 1 1 2 0 0 1 0 0 0 0 1 1 1 2 2 1 1 1 1 1 0 0 0 1 1 1 1 1 1 0 1 0 1 1 ...
output:
0 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 11...
result:
ok Accepted
Test #34:
score: 0
Accepted
time: 274ms
memory: 3716kb
input:
992 1 1 1 2 1 0 1 1 2 0 1 1 0 1 2 2 1 1 2 1 2 0 1 2 0 2 2 2 1 2 0 1 2 0 1 0 1 1 1 1 2 1 1 1 2 2 2 2 2 1 0 1 1 2 0 1 0 1 1 0 0 1 1 0 0 1 0 0 1 2 0 0 0 2 2 1 1 1 0 0 1 1 0 2 1 1 2 1 0 1 1 1 1 2 1 1 1 2 1 1 1 1 1 0 0 2 1 1 1 1 2 0 1 2 1 1 2 0 0 1 0 0 0 0 1 1 1 2 2 1 1 1 1 1 0 0 0 1 1 1 1 1 1 0 1 0 1 1 ...
output:
0 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 11...
result:
ok Accepted
Test #35:
score: 0
Accepted
time: 285ms
memory: 3644kb
input:
993 1 1 1 2 1 0 1 1 2 0 1 1 0 1 2 2 1 1 2 1 2 0 1 2 0 2 2 2 1 2 0 1 2 0 1 0 1 1 1 1 2 1 1 1 2 2 2 2 2 1 0 1 1 2 0 1 0 1 1 0 0 1 1 0 0 1 0 0 1 2 0 0 0 2 2 1 1 1 0 0 1 1 0 2 1 1 2 1 0 1 1 1 1 2 1 1 1 2 1 1 1 1 1 0 0 2 1 1 1 1 2 0 1 2 1 1 2 0 0 1 0 0 0 0 1 1 1 2 2 1 1 1 1 1 0 0 0 1 1 1 1 1 1 0 1 0 1 1 ...
output:
0 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 11...
result:
ok Accepted
Test #36:
score: 0
Accepted
time: 264ms
memory: 3708kb
input:
994 1 1 1 2 1 0 1 1 2 0 1 1 0 1 2 2 1 1 2 1 2 0 1 2 0 2 2 2 1 2 0 1 2 0 1 0 1 1 1 1 2 1 1 1 2 2 2 2 2 1 0 1 1 2 0 1 0 1 1 0 0 1 1 0 0 1 0 0 1 2 0 0 0 2 2 1 1 1 0 0 1 1 0 2 1 1 2 1 0 1 1 1 1 2 1 1 1 2 1 1 1 1 1 0 0 2 1 1 1 1 2 0 1 2 1 1 2 0 0 1 0 0 0 0 1 1 1 2 2 1 1 1 1 1 0 0 0 1 1 1 1 1 1 0 1 0 1 1 ...
output:
0 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 11...
result:
ok Accepted
Test #37:
score: 0
Accepted
time: 264ms
memory: 3596kb
input:
995 1 1 1 2 1 0 1 1 2 0 1 1 0 1 2 2 1 1 2 1 2 0 1 2 0 2 2 2 1 2 0 1 2 0 1 0 1 1 1 1 2 1 1 1 2 2 2 2 2 1 0 1 1 2 0 1 0 1 1 0 0 1 1 0 0 1 0 0 1 2 0 0 0 2 2 1 1 1 0 0 1 1 0 2 1 1 2 1 0 1 1 1 1 2 1 1 1 2 1 1 1 1 1 0 0 2 1 1 1 1 2 0 1 2 1 1 2 0 0 1 0 0 0 0 1 1 1 2 2 1 1 1 1 1 0 0 0 1 1 1 1 1 1 0 1 0 1 1 ...
output:
0 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 11...
result:
ok Accepted
Test #38:
score: 0
Accepted
time: 247ms
memory: 3656kb
input:
996 1 1 1 2 1 0 1 1 2 0 1 1 0 1 2 2 1 1 2 1 2 0 1 2 0 2 2 2 1 2 0 1 2 0 1 0 1 1 1 1 2 1 1 1 2 2 2 2 2 1 0 1 1 2 0 1 0 1 1 0 0 1 1 0 0 1 0 0 1 2 0 0 0 2 2 1 1 1 0 0 1 1 0 2 1 1 2 1 0 1 1 1 1 2 1 1 1 2 1 1 1 1 1 0 0 2 1 1 1 1 2 0 1 2 1 1 2 0 0 1 0 0 0 0 1 1 1 2 2 1 1 1 1 1 0 0 0 1 1 1 1 1 1 0 1 0 1 1 ...
output:
0 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 11...
result:
ok Accepted
Test #39:
score: 0
Accepted
time: 260ms
memory: 3876kb
input:
997 1 1 1 2 1 0 1 1 2 0 1 1 0 1 2 2 1 1 2 1 2 0 1 2 0 2 2 2 1 2 0 1 2 0 1 0 1 1 1 1 2 1 1 1 2 2 2 2 2 1 0 1 1 2 0 1 0 1 1 0 0 1 1 0 0 1 0 0 1 2 0 0 0 2 2 1 1 1 0 0 1 1 0 2 1 1 2 1 0 1 1 1 1 2 1 1 1 2 1 1 1 1 1 0 0 2 1 1 1 1 2 0 1 2 1 1 2 0 0 1 0 0 0 0 1 1 1 2 2 1 1 1 1 1 0 0 0 1 1 1 1 1 1 0 1 0 1 1 ...
output:
0 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 11...
result:
ok Accepted
Test #40:
score: 0
Accepted
time: 267ms
memory: 3708kb
input:
998 1 1 1 2 1 0 1 1 2 0 1 1 0 1 2 2 1 1 2 1 2 0 1 2 0 2 2 2 1 2 0 1 2 0 1 0 1 1 1 1 2 1 1 1 2 2 2 2 2 1 0 1 1 2 0 1 0 1 1 0 0 1 1 0 0 1 0 0 1 2 0 0 0 2 2 1 1 1 0 0 1 1 0 2 1 1 2 1 0 1 1 1 1 2 1 1 1 2 1 1 1 1 1 0 0 2 1 1 1 1 2 0 1 2 1 1 2 0 0 1 0 0 0 0 1 1 1 2 2 1 1 1 1 1 0 0 0 1 1 1 1 1 1 0 1 0 1 1 ...
output:
0 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 11...
result:
ok Accepted
Test #41:
score: 0
Accepted
time: 279ms
memory: 3660kb
input:
999 1 1 1 2 1 0 1 1 2 0 1 1 0 1 2 2 1 1 2 1 2 0 1 2 0 2 2 2 1 2 0 1 2 0 1 0 1 1 1 1 2 1 1 1 2 2 2 2 2 1 0 1 1 2 0 1 0 1 1 0 0 1 1 0 0 1 0 0 1 2 0 0 0 2 2 1 1 1 0 0 1 1 0 2 1 1 2 1 0 1 1 1 1 2 1 1 1 2 1 1 1 1 1 0 0 2 1 1 1 1 2 0 1 2 1 1 2 0 0 1 0 0 0 0 1 1 1 2 2 1 1 1 1 1 0 0 0 1 1 1 1 1 1 0 1 0 1 1 ...
output:
0 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 11...
result:
ok Accepted
Extra Test:
score: 0
Extra Test Passed