QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#610996 | #9432. Permutation | Fork512Hz | AC ✓ | 251ms | 3840kb | C++20 | 2.1kb | 2024-10-04 18:41:30 | 2024-10-04 18:41:30 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vll;
typedef pair<ll, ll> pii;
//#define DEBUG
#ifdef DEBUG
const ll N = 1010;
#endif
#ifndef DEBUG
const ll N = 1010;
#endif
ll a[N], b[N], buf[N];
ll n;
ll query()
{
cout << "0 ";
for(ll i=0; i<n; i++)
cout << buf[i] << ' ';
cout << '\n';
ll tmp;
cout.flush();
cin >> tmp;
return tmp;
}
inline void brush(ll lb, ll rb, ll x)
{
for(ll i=lb; i<rb; i++)
buf[i] = x;
}
void solve(ll lb, ll rb)
{
if(rb - lb <= 1) return;
for(ll i=lb; i<rb; i++)
b[i] = a[i];
ll k1 = lb, k2 = rb-1;
ll group = 1, pos1 = rb;
ll mid = (lb + rb) >> 1;
brush(0, lb, b[lb]);
brush(rb, n, b[lb]);
while(pos1 > lb)
{
ll pos2 = lb;
ll i;
for(i=lb; i+group<pos1; i+=group*2)
{
brush(lb, mid, b[i]);
brush(mid, rb, b[i+group]);
switch(query())
{
case 0:
for(ll j=group; j<2*group; j++)
{
a[k1] = b[i+j];
k1++;
}
for(ll j=0; j<group; j++)
{
a[k2] = b[i+j];
k2--;
}
break;
case 2:
for(ll j=0; j<group; j++)
{
a[k1] = b[i+j];
k1++;
}
for(ll j=group; j<2*group; j++)
{
a[k2] = b[i+j];
k2--;
}
break;
case 1:
for(ll j=0; j<2*group; j++)
{
b[pos2] = b[i+j];
pos2++;
}
break;
}
}
if(i < pos1)
{
if((mid - k1) / group % 2) for(; i<pos1; i++)
{
a[k1] = b[i];
k1++;
}
else for(; i<pos1; i++)
{
a[k2] = b[i];
k2--;
}
}
pos1 = pos2;
group <<= 1;
}
solve(lb, mid);
solve(mid, rb);
}
int main()
{
// #ifndef DEBUG
// ios::sync_with_stdio(false);
// cin.tie(0);
// cout.tie(0);
// #endif
#ifdef DEBUG
freopen("1.txt", "r", stdin);
#endif
srand(time(NULL));
cin >> n;
// const ll aa[8] = {8, 7, 6, 2, 5, 1, 3, 4};
for(ll i=0; i<n; i++) a[i] = i+1;
random_shuffle(a, a+n);
solve(0, n);
cout << "1 ";
for(ll i=0; i<n; i++)
cout << a[i] << ' ';
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 1ms
memory: 3668kb
input:
5 0 2 0 2 0
output:
0 5 5 4 4 4 0 3 3 1 1 1 0 4 3 4 4 4 0 2 2 2 1 1 0 5 5 5 5 1 1 3 4 2 1 5
result:
ok Accepted
Test #2:
score: 0
Accepted
time: 251ms
memory: 3688kb
input:
1000 1 0 1 2 2 1 1 2 1 0 0 0 0 2 1 0 2 1 2 1 0 0 1 1 0 1 2 2 0 1 1 1 1 0 1 2 2 0 1 2 1 1 1 2 2 1 0 2 2 2 1 1 1 0 1 0 1 0 0 1 2 1 2 1 1 2 2 0 2 0 0 2 1 1 1 2 1 2 1 2 2 0 0 0 1 2 2 2 1 1 1 2 0 1 1 1 2 0 2 1 1 1 0 0 1 0 0 1 2 1 1 1 1 0 2 1 1 2 0 2 2 1 0 1 1 1 1 2 1 2 2 1 0 2 0 1 1 1 2 1 2 2 0 1 1 2 0 1...
output:
0 632 632 632 632 632 632 632 632 632 632 632 632 632 632 632 632 632 632 632 632 632 632 632 632 632 632 632 632 632 632 632 632 632 632 632 632 632 632 632 632 632 632 632 632 632 632 632 632 632 632 632 632 632 632 632 632 632 632 632 632 632 632 632 632 632 632 632 632 632 632 632 632 632 632 63...
result:
ok Accepted
Test #3:
score: 0
Accepted
time: 0ms
memory: 3752kb
input:
1
output:
1 1
result:
ok Accepted
Test #4:
score: 0
Accepted
time: 1ms
memory: 3696kb
input:
2 0
output:
0 1 2 1 2 1
result:
ok Accepted
Test #5:
score: 0
Accepted
time: 0ms
memory: 3632kb
input:
3 2 2
output:
0 3 2 2 0 1 1 2 1 3 1 2
result:
ok Accepted
Test #6:
score: 0
Accepted
time: 0ms
memory: 3760kb
input:
4 2 0 0 0
output:
0 4 4 2 2 0 1 1 3 3 0 4 3 4 4 0 1 1 1 2 1 3 4 2 1
result:
ok Accepted
Test #7:
score: 0
Accepted
time: 0ms
memory: 3760kb
input:
6 2 1 1 0 1 0 0 0
output:
0 4 4 4 5 5 5 0 1 1 1 6 6 6 0 2 2 2 3 3 3 0 1 1 1 2 2 2 0 4 2 2 4 4 4 0 2 2 4 2 2 2 0 6 6 6 6 1 1 0 5 5 5 5 5 6 1 3 4 2 1 6 5
result:
ok Accepted
Test #8:
score: 0
Accepted
time: 1ms
memory: 3752kb
input:
7 1 1 1 1 1 2 1 1 2 0 0
output:
0 4 4 4 5 5 5 5 0 1 1 1 6 6 6 6 0 7 7 7 3 3 3 3 0 4 4 4 1 1 1 1 0 2 7 7 2 2 2 2 0 7 7 2 7 7 7 7 0 6 6 6 6 6 1 1 0 6 6 6 5 5 4 4 0 6 6 6 6 6 5 5 0 6 6 6 6 1 6 6 0 4 4 4 4 4 4 5 1 3 7 2 1 6 5 4
result:
ok Accepted
Test #9:
score: 0
Accepted
time: 0ms
memory: 3760kb
input:
8 1 1 1 1 1 1 0 1 1 2 0 0 2 2 2 2
output:
0 4 4 4 4 5 5 5 5 0 8 8 8 8 6 6 6 6 0 7 7 7 7 3 3 3 3 0 2 2 2 2 1 1 1 1 0 4 4 4 4 8 8 8 8 0 7 7 7 7 2 2 2 2 0 4 4 4 4 7 7 7 7 0 7 7 3 3 7 7 7 7 0 2 2 1 1 7 7 7 7 0 7 7 2 2 7 7 7 7 0 7 3 7 7 7 7 7 7 0 1 1 1 2 1 1 1 1 0 6 6 6 6 6 6 8 8 0 6 6 6 6 5 5 4 4 0 6 6 6 6 6 5 6 6 0 4 4 4 4 4 4 4...
result:
ok Accepted
Test #10:
score: 0
Accepted
time: 1ms
memory: 3628kb
input:
9 1 1 0 1 1 1 1 2 2 0 1 2 0 1 0
output:
0 4 4 4 4 5 5 5 5 5 0 8 8 8 8 6 6 6 6 6 0 9 9 9 9 3 3 3 3 3 0 2 2 2 2 1 1 1 1 1 0 4 4 4 4 8 8 8 8 8 0 3 3 7 7 3 3 3 3 3 0 2 2 1 1 3 3 3 3 3 0 3 3 2 2 3 3 3 3 3 0 3 7 3 3 3 3 3 3 3 0 1 1 1 2 1 1 1 1 1 0 6 6 6 6 6 6 8 8 8 0 6 6 6 6 5 5 4 4 4 0 5 5 5 5 5 9 5 5 5 0 8 8 8 8 8 8 8 6 6 0 6 6 ...
result:
ok Accepted
Test #11:
score: 0
Accepted
time: 0ms
memory: 3692kb
input:
10 1 1 1 0 1 1 1 0 1 1 0 2 2 0 1 1 0 2 2 0
output:
0 4 4 4 4 4 5 5 5 5 5 0 8 8 8 8 8 6 6 6 6 6 0 10 10 10 10 10 3 3 3 3 3 0 2 2 2 2 2 1 1 1 1 1 0 7 7 7 7 7 9 9 9 9 9 0 4 4 4 4 4 8 8 8 8 8 0 10 10 10 10 10 7 7 7 7 7 0 4 4 4 4 4 10 10 10 10 10 0 1 1 10 10 10 1 1 1 1 1 0 3 3 7 7 7 1 1 1 1 1 0 1 1 3 3 3 1 1 1 1 1 0 3 7 3 3 3 3 3 3 3 3 0 10 1...
result:
ok Accepted
Test #12:
score: 0
Accepted
time: 0ms
memory: 3752kb
input:
11 1 1 1 1 1 1 2 1 1 0 2 2 0 1 1 2 0 0 2 0 2
output:
0 4 4 4 4 4 5 5 5 5 5 5 0 8 8 8 8 8 6 6 6 6 6 6 0 10 10 10 10 10 3 3 3 3 3 3 0 2 2 2 2 2 11 11 11 11 11 11 0 7 7 7 7 7 9 9 9 9 9 9 0 4 4 4 4 4 8 8 8 8 8 8 0 10 10 10 10 10 2 2 2 2 2 2 0 1 1 10 10 10 1 1 1 1 1 1 0 3 3 7 7 7 1 1 1 1 1 1 0 1 1 3 3 3 1 1 1 1 1 1 0 3 7 3 3 3 3 3 3 3 3 3 0 10 1...
result:
ok Accepted
Test #13:
score: 0
Accepted
time: 1ms
memory: 3764kb
input:
12 0 1 2 1 1 1 1 1 0 0 2 0 1 2 2 0 2 1 1 0 1 0 1 0
output:
0 4 4 4 4 4 4 5 5 5 5 5 5 0 8 8 8 8 8 8 6 6 6 6 6 6 0 10 10 10 10 10 10 12 12 12 12 12 12 0 2 2 2 2 2 2 11 11 11 11 11 11 0 7 7 7 7 7 7 9 9 9 9 9 9 0 1 1 1 1 1 1 3 3 3 3 3 3 0 8 8 8 8 8 8 2 2 2 2 2 2 0 7 7 7 7 7 7 1 1 1 1 1 1 0 8 8 8 8 8 8 7 7 7 7 7 7 0 5 5 5 10 10 10 5 5 5 5 5 5 0 7 7 7 9...
result:
ok Accepted
Test #14:
score: 0
Accepted
time: 1ms
memory: 3748kb
input:
13 0 1 2 1 1 2 1 1 1 2 2 0 0 0 2 2 1 0 1 0 2 0 0 0
output:
0 4 4 4 4 4 4 13 13 13 13 13 13 13 0 8 8 8 8 8 8 6 6 6 6 6 6 6 0 10 10 10 10 10 10 12 12 12 12 12 12 12 0 2 2 2 2 2 2 11 11 11 11 11 11 11 0 7 7 7 7 7 7 9 9 9 9 9 9 9 0 1 1 1 1 1 1 3 3 3 3 3 3 3 0 8 8 8 8 8 8 2 2 2 2 2 2 2 0 13 13 13 10 10 10 13 13 13 13 13 13 13 0 1 1 1 5 5 5 13 13 13 13 13...
result:
ok Accepted
Test #15:
score: 0
Accepted
time: 1ms
memory: 3760kb
input:
14 1 2 2 1 1 2 1 2 2 0 1 1 0 0 2 0 2 2 2 1 1 0 0 0 0 0 2 2 2
output:
0 4 4 4 4 4 4 4 13 13 13 13 13 13 13 0 14 14 14 14 14 14 14 6 6 6 6 6 6 6 0 10 10 10 10 10 10 10 12 12 12 12 12 12 12 0 2 2 2 2 2 2 2 11 11 11 11 11 11 11 0 7 7 7 7 7 7 7 9 9 9 9 9 9 9 0 1 1 1 1 1 1 1 3 3 3 3 3 3 3 0 5 5 5 5 5 5 5 8 8 8 8 8 8 8 0 4 4 4 4 4 4 4 2 2 2 2 2 2 2 0 7 7 7 7 7 7 7 5...
result:
ok Accepted
Test #16:
score: 0
Accepted
time: 0ms
memory: 3696kb
input:
15 2 0 1 1 2 1 2 0 1 0 1 0 0 2 2 2 0 0 1 1 2 0 0 2 0 2 2 1 1 0 0 2
output:
0 15 15 15 15 15 15 15 8 8 8 8 8 8 8 8 0 3 3 3 3 3 3 3 9 9 9 9 9 9 9 9 0 12 12 12 12 12 12 12 2 2 2 2 2 2 2 2 0 7 7 7 7 7 7 7 1 1 1 1 1 1 1 1 0 4 4 4 4 4 4 4 6 6 6 6 6 6 6 6 0 14 14 14 14 14 14 14 5 5 5 5 5 5 5 5 0 10 10 10 10 10 10 10 11 11 11 11 11 11 11 11 0 12 12 12 12 12 12 12 7 7 7 7 7 ...
result:
ok Accepted
Test #17:
score: 0
Accepted
time: 219ms
memory: 3740kb
input:
975 1 0 2 0 1 0 1 2 2 0 1 2 1 2 0 0 1 2 1 0 2 1 0 1 1 2 1 1 0 1 1 2 0 0 1 1 0 2 2 0 0 1 1 1 0 0 1 1 1 2 2 0 1 1 2 0 1 1 1 0 2 1 1 0 1 1 1 1 0 0 2 1 1 1 1 2 0 0 1 2 2 0 1 0 1 1 2 1 2 1 1 2 1 1 1 0 2 1 2 1 2 2 1 1 2 1 1 1 1 1 2 0 1 1 2 2 1 1 0 2 1 1 1 1 1 1 2 1 1 2 1 2 1 1 1 1 1 1 0 0 2 2 2 0 1 1 0 0 ...
output:
0 231 231 231 231 231 231 231 231 231 231 231 231 231 231 231 231 231 231 231 231 231 231 231 231 231 231 231 231 231 231 231 231 231 231 231 231 231 231 231 231 231 231 231 231 231 231 231 231 231 231 231 231 231 231 231 231 231 231 231 231 231 231 231 231 231 231 231 231 231 231 231 231 231 231 23...
result:
ok Accepted
Test #18:
score: 0
Accepted
time: 218ms
memory: 3764kb
input:
976 1 2 1 2 2 1 0 1 2 1 0 1 0 0 1 1 0 1 0 1 1 1 1 0 1 1 0 2 1 2 1 2 0 2 1 0 2 1 0 1 0 1 0 2 0 0 0 2 1 1 1 0 0 2 1 0 1 0 1 1 2 0 1 2 1 0 2 1 0 1 1 0 0 0 1 2 1 0 1 1 2 0 2 0 0 2 0 1 2 1 1 0 1 1 2 1 1 1 1 0 1 1 2 2 0 2 2 1 1 0 1 1 1 0 0 0 1 1 1 1 2 2 1 1 1 1 2 1 0 1 2 2 2 2 1 0 1 1 0 2 2 1 2 1 2 1 1 2 ...
output:
0 903 903 903 903 903 903 903 903 903 903 903 903 903 903 903 903 903 903 903 903 903 903 903 903 903 903 903 903 903 903 903 903 903 903 903 903 903 903 903 903 903 903 903 903 903 903 903 903 903 903 903 903 903 903 903 903 903 903 903 903 903 903 903 903 903 903 903 903 903 903 903 903 903 903 90...
result:
ok Accepted
Test #19:
score: 0
Accepted
time: 217ms
memory: 3692kb
input:
977 1 1 1 2 1 0 1 0 1 0 0 2 1 1 1 1 0 2 1 0 1 2 2 1 1 2 2 1 1 2 1 1 2 1 2 1 1 1 1 1 1 1 0 0 1 1 0 2 1 0 0 2 0 2 1 2 1 1 0 0 2 0 2 1 0 1 1 1 2 1 1 2 1 1 0 2 1 1 1 1 1 2 1 2 1 1 2 2 1 1 2 2 2 1 2 2 1 1 1 2 2 1 1 1 1 1 1 1 0 1 0 0 1 2 0 0 2 0 1 0 2 2 2 1 1 1 1 1 2 2 1 0 1 1 2 2 2 0 1 1 1 1 0 1 1 0 1 1 ...
output:
0 140 140 140 140 140 140 140 140 140 140 140 140 140 140 140 140 140 140 140 140 140 140 140 140 140 140 140 140 140 140 140 140 140 140 140 140 140 140 140 140 140 140 140 140 140 140 140 140 140 140 140 140 140 140 140 140 140 140 140 140 140 140 140 140 140 140 140 140 140 140 140 140 140 140 14...
result:
ok Accepted
Test #20:
score: 0
Accepted
time: 219ms
memory: 3840kb
input:
978 2 0 1 1 1 2 2 0 1 1 1 1 0 2 0 0 1 1 2 1 1 2 1 2 2 2 0 1 1 1 1 1 1 2 2 1 0 1 1 2 0 1 0 2 1 1 1 0 1 1 1 1 0 0 0 0 1 0 1 1 2 2 1 1 1 2 1 2 0 2 1 1 1 0 2 0 1 0 1 0 2 0 1 1 1 0 2 1 2 1 1 1 1 2 1 0 0 1 1 2 0 0 1 0 1 1 0 1 2 1 2 2 1 0 1 2 2 2 1 1 1 1 2 1 1 1 0 1 1 0 1 1 1 1 2 1 2 0 0 2 1 0 1 2 1 1 1 1 ...
output:
0 521 521 521 521 521 521 521 521 521 521 521 521 521 521 521 521 521 521 521 521 521 521 521 521 521 521 521 521 521 521 521 521 521 521 521 521 521 521 521 521 521 521 521 521 521 521 521 521 521 521 521 521 521 521 521 521 521 521 521 521 521 521 521 521 521 521 521 521 521 521 521 521 521 521 52...
result:
ok Accepted
Test #21:
score: 0
Accepted
time: 238ms
memory: 3648kb
input:
979 1 1 0 1 1 2 2 2 0 1 1 2 0 1 2 1 1 1 1 0 1 2 1 0 1 1 0 0 0 0 0 1 0 0 1 1 2 1 0 1 1 2 0 0 0 0 1 0 1 0 2 1 1 1 2 1 2 0 0 2 1 1 1 2 1 1 1 2 1 0 1 1 1 2 2 1 2 2 1 1 1 2 1 1 1 0 2 1 1 1 1 2 0 2 2 0 0 1 1 1 1 1 1 1 1 0 1 1 2 2 2 1 2 2 1 0 1 1 1 1 2 1 0 1 1 1 2 1 1 2 2 2 2 2 0 2 2 2 0 0 0 1 2 1 2 2 1 2 ...
output:
0 941 941 941 941 941 941 941 941 941 941 941 941 941 941 941 941 941 941 941 941 941 941 941 941 941 941 941 941 941 941 941 941 941 941 941 941 941 941 941 941 941 941 941 941 941 941 941 941 941 941 941 941 941 941 941 941 941 941 941 941 941 941 941 941 941 941 941 941 941 941 941 941 941 941 94...
result:
ok Accepted
Test #22:
score: 0
Accepted
time: 217ms
memory: 3680kb
input:
980 0 1 2 2 1 0 0 2 2 0 1 0 1 1 0 1 2 1 1 0 0 2 1 2 0 0 2 0 2 2 0 0 1 2 1 1 2 1 0 1 1 1 1 2 0 0 2 2 0 0 0 1 2 1 1 1 1 1 1 1 0 1 2 0 1 0 0 1 1 1 2 0 2 0 2 2 2 1 1 1 1 0 0 1 2 1 1 0 2 1 1 0 1 0 0 1 0 0 1 1 2 0 1 1 2 1 0 0 0 0 2 2 2 0 1 2 0 2 1 1 1 2 1 1 0 0 0 2 0 0 1 0 0 1 2 1 1 2 0 1 1 0 0 0 1 1 2 1 ...
output:
0 835 835 835 835 835 835 835 835 835 835 835 835 835 835 835 835 835 835 835 835 835 835 835 835 835 835 835 835 835 835 835 835 835 835 835 835 835 835 835 835 835 835 835 835 835 835 835 835 835 835 835 835 835 835 835 835 835 835 835 835 835 835 835 835 835 835 835 835 835 835 835 835 835 835 83...
result:
ok Accepted
Test #23:
score: 0
Accepted
time: 235ms
memory: 3680kb
input:
981 2 2 1 0 1 1 0 2 2 1 2 1 1 0 0 1 1 0 1 0 1 2 2 0 2 1 0 1 0 2 1 0 1 0 1 0 0 1 2 2 1 0 2 0 1 1 2 0 1 0 1 1 2 0 2 0 1 2 2 1 2 1 1 1 2 1 0 0 1 0 2 1 2 1 0 1 1 1 1 0 1 1 2 0 2 1 1 2 0 2 1 0 2 2 1 1 1 2 0 1 0 1 1 1 2 1 0 2 1 1 1 2 2 1 1 2 1 0 2 0 1 1 0 1 0 2 0 0 1 2 0 0 0 2 1 2 1 2 0 0 1 0 2 0 0 1 1 2 ...
output:
0 355 355 355 355 355 355 355 355 355 355 355 355 355 355 355 355 355 355 355 355 355 355 355 355 355 355 355 355 355 355 355 355 355 355 355 355 355 355 355 355 355 355 355 355 355 355 355 355 355 355 355 355 355 355 355 355 355 355 355 355 355 355 355 355 355 355 355 355 355 355 355 355 355 355 35...
result:
ok Accepted
Test #24:
score: 0
Accepted
time: 217ms
memory: 3784kb
input:
982 0 2 2 2 2 1 0 0 2 1 1 2 1 0 1 1 2 1 0 1 1 0 1 0 2 1 2 0 2 1 1 1 2 1 0 2 1 2 1 1 1 1 1 1 2 1 1 1 1 1 2 1 1 1 1 2 1 2 0 0 0 1 1 2 0 1 1 1 1 1 1 1 2 2 2 1 0 1 2 1 2 0 0 1 1 1 1 0 1 0 0 2 2 1 2 1 2 1 2 1 0 2 1 2 1 2 0 1 0 0 1 0 1 1 1 1 0 1 1 2 1 1 0 0 1 1 0 1 1 1 0 2 1 0 0 0 1 0 0 0 2 1 0 0 0 1 0 1 ...
output:
0 529 529 529 529 529 529 529 529 529 529 529 529 529 529 529 529 529 529 529 529 529 529 529 529 529 529 529 529 529 529 529 529 529 529 529 529 529 529 529 529 529 529 529 529 529 529 529 529 529 529 529 529 529 529 529 529 529 529 529 529 529 529 529 529 529 529 529 529 529 529 529 529 529 529 52...
result:
ok Accepted
Test #25:
score: 0
Accepted
time: 223ms
memory: 3732kb
input:
983 0 2 2 1 1 1 1 1 2 1 0 1 1 2 2 2 0 0 2 1 2 2 1 0 2 0 2 0 1 2 2 1 2 0 2 0 1 1 0 2 2 1 0 1 2 2 0 1 1 1 1 2 1 2 2 1 1 1 0 1 2 1 2 2 0 2 0 0 2 2 1 2 0 2 0 0 1 1 1 1 2 1 2 1 1 1 1 1 1 1 1 1 0 2 1 1 1 0 0 0 1 1 0 1 2 1 0 1 1 2 2 1 1 0 1 2 2 0 1 1 2 1 1 1 1 1 1 1 1 2 1 0 0 2 2 1 0 1 0 1 2 1 0 2 0 0 1 1 ...
output:
0 162 162 162 162 162 162 162 162 162 162 162 162 162 162 162 162 162 162 162 162 162 162 162 162 162 162 162 162 162 162 162 162 162 162 162 162 162 162 162 162 162 162 162 162 162 162 162 162 162 162 162 162 162 162 162 162 162 162 162 162 162 162 162 162 162 162 162 162 162 162 162 162 162 162 16...
result:
ok Accepted
Test #26:
score: 0
Accepted
time: 218ms
memory: 3764kb
input:
984 1 2 1 0 1 2 1 0 2 0 1 1 2 0 0 0 0 0 1 0 0 2 2 1 2 1 0 0 0 1 1 1 1 0 1 0 2 0 1 2 0 0 2 2 1 0 2 1 0 2 1 1 1 1 1 2 0 1 2 2 0 1 1 1 2 0 1 0 0 2 0 2 1 1 2 0 2 2 2 1 0 1 2 0 1 1 0 0 1 1 1 1 1 2 2 2 2 1 1 1 1 0 1 1 0 2 1 0 2 2 0 1 2 1 1 2 0 1 0 2 1 2 2 1 1 1 0 1 2 2 1 2 1 1 2 2 1 1 0 1 2 0 1 1 0 1 1 0 ...
output:
0 181 181 181 181 181 181 181 181 181 181 181 181 181 181 181 181 181 181 181 181 181 181 181 181 181 181 181 181 181 181 181 181 181 181 181 181 181 181 181 181 181 181 181 181 181 181 181 181 181 181 181 181 181 181 181 181 181 181 181 181 181 181 181 181 181 181 181 181 181 181 181 181 181 181 18...
result:
ok Accepted
Test #27:
score: 0
Accepted
time: 223ms
memory: 3684kb
input:
985 1 0 0 1 0 1 1 2 1 1 1 2 1 0 0 2 0 2 1 0 2 1 1 1 1 1 2 1 1 1 1 1 1 1 1 1 2 2 2 1 1 2 2 1 0 1 2 1 2 0 0 2 2 1 1 0 0 2 1 0 1 1 2 0 1 2 1 1 1 0 1 0 1 2 2 1 2 0 1 1 1 1 0 0 0 0 1 0 0 1 2 2 1 2 2 1 2 1 1 2 0 1 1 0 1 2 2 1 0 0 2 2 1 0 0 0 0 0 0 1 0 2 0 2 1 1 1 1 1 2 1 1 1 0 2 2 1 0 1 1 0 1 0 2 2 0 1 2 ...
output:
0 965 965 965 965 965 965 965 965 965 965 965 965 965 965 965 965 965 965 965 965 965 965 965 965 965 965 965 965 965 965 965 965 965 965 965 965 965 965 965 965 965 965 965 965 965 965 965 965 965 965 965 965 965 965 965 965 965 965 965 965 965 965 965 965 965 965 965 965 965 965 965 965 965 965 96...
result:
ok Accepted
Test #28:
score: 0
Accepted
time: 233ms
memory: 3764kb
input:
986 2 2 2 1 1 0 0 1 1 2 1 1 2 2 1 2 1 0 2 0 1 2 2 0 2 0 1 1 2 2 1 0 2 0 2 1 1 2 0 0 2 1 1 1 1 1 2 1 0 2 1 1 0 1 1 0 1 0 1 1 1 2 1 2 2 2 0 1 2 2 2 1 1 0 1 2 1 0 1 1 0 0 2 1 1 2 0 2 0 2 2 1 1 1 1 1 2 1 2 1 1 0 1 2 0 1 2 0 1 1 2 1 0 1 1 1 0 0 1 1 0 1 2 0 0 1 2 0 1 2 2 0 0 2 1 2 0 2 1 1 1 1 2 1 0 1 1 0 ...
output:
0 96 96 96 96 96 96 96 96 96 96 96 96 96 96 96 96 96 96 96 96 96 96 96 96 96 96 96 96 96 96 96 96 96 96 96 96 96 96 96 96 96 96 96 96 96 96 96 96 96 96 96 96 96 96 96 96 96 96 96 96 96 96 96 96 96 96 96 96 96 96 96 96 96 96 96 96 96 96 96 96 96 96 96 96 96 96 96 96 96 96 96 96 96 96 96 96 96 96 96 9...
result:
ok Accepted
Test #29:
score: 0
Accepted
time: 244ms
memory: 3788kb
input:
987 1 2 1 2 0 0 1 2 1 1 1 1 0 0 0 0 0 1 1 1 2 0 1 0 1 1 1 1 1 2 1 1 2 1 2 0 2 2 2 0 1 2 1 1 1 2 0 1 1 0 2 1 0 2 0 2 0 1 0 0 1 1 1 1 0 1 2 1 2 0 2 2 2 2 0 0 2 2 1 1 1 1 1 1 1 0 1 1 1 2 1 1 0 0 0 0 1 1 0 2 2 0 1 1 0 0 2 1 1 0 1 2 1 2 1 2 1 2 1 0 1 0 1 1 2 0 1 0 0 1 0 2 1 2 0 2 1 2 1 2 1 1 0 2 1 0 0 0 ...
output:
0 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 4...
result:
ok Accepted
Test #30:
score: 0
Accepted
time: 224ms
memory: 3684kb
input:
988 1 1 1 1 2 1 1 0 1 1 1 0 2 1 1 1 0 1 1 1 0 1 1 1 0 2 1 2 2 1 1 1 2 1 0 2 1 1 2 2 1 1 2 1 1 2 1 2 1 1 2 0 1 1 1 2 0 1 1 1 1 0 1 2 2 0 2 2 2 0 0 0 0 1 0 2 2 1 1 2 0 1 1 1 1 1 2 1 1 1 1 1 0 1 2 0 1 0 1 1 2 1 1 0 1 2 0 2 1 2 1 0 1 0 1 1 1 2 1 1 2 1 1 2 0 1 1 1 1 1 1 1 1 1 1 1 2 1 1 0 0 2 1 2 1 0 1 0 ...
output:
0 841 841 841 841 841 841 841 841 841 841 841 841 841 841 841 841 841 841 841 841 841 841 841 841 841 841 841 841 841 841 841 841 841 841 841 841 841 841 841 841 841 841 841 841 841 841 841 841 841 841 841 841 841 841 841 841 841 841 841 841 841 841 841 841 841 841 841 841 841 841 841 841 841 841 84...
result:
ok Accepted
Test #31:
score: 0
Accepted
time: 217ms
memory: 3776kb
input:
989 0 1 0 1 0 0 1 1 1 0 2 1 0 1 0 2 2 2 1 1 0 0 1 1 0 0 0 2 0 0 0 1 1 1 0 2 2 1 2 1 1 0 0 0 1 0 1 1 1 1 1 2 0 2 1 1 2 2 1 0 0 1 0 1 2 1 1 0 2 0 2 2 1 2 2 2 0 2 0 0 2 1 1 0 0 0 0 1 1 2 1 1 1 0 1 1 0 1 0 1 1 0 0 2 1 1 2 0 1 0 0 0 2 1 1 0 2 2 1 1 2 0 2 0 0 2 0 1 1 1 1 2 2 2 1 0 1 2 0 0 0 1 0 0 1 1 1 1 ...
output:
0 469 469 469 469 469 469 469 469 469 469 469 469 469 469 469 469 469 469 469 469 469 469 469 469 469 469 469 469 469 469 469 469 469 469 469 469 469 469 469 469 469 469 469 469 469 469 469 469 469 469 469 469 469 469 469 469 469 469 469 469 469 469 469 469 469 469 469 469 469 469 469 469 469 469 46...
result:
ok Accepted
Test #32:
score: 0
Accepted
time: 234ms
memory: 3648kb
input:
990 1 1 1 0 1 2 0 1 2 1 1 1 2 1 1 2 1 1 1 0 1 1 2 1 2 0 1 1 1 1 1 0 1 2 0 1 0 1 0 0 2 2 0 1 2 1 0 0 1 1 2 1 2 2 1 2 1 0 2 0 0 1 1 2 0 1 1 1 0 1 1 2 1 1 1 1 1 0 1 0 1 1 0 1 2 1 1 0 1 1 0 1 1 1 0 1 1 1 0 2 0 2 1 1 2 0 1 0 1 1 0 1 2 0 1 2 1 1 1 0 1 2 2 1 1 1 1 1 1 2 1 0 0 0 2 1 1 1 1 0 1 1 1 0 1 0 0 0 ...
output:
0 275 275 275 275 275 275 275 275 275 275 275 275 275 275 275 275 275 275 275 275 275 275 275 275 275 275 275 275 275 275 275 275 275 275 275 275 275 275 275 275 275 275 275 275 275 275 275 275 275 275 275 275 275 275 275 275 275 275 275 275 275 275 275 275 275 275 275 275 275 275 275 275 275 275 27...
result:
ok Accepted
Test #33:
score: 0
Accepted
time: 230ms
memory: 3836kb
input:
991 1 1 2 1 2 1 1 1 0 0 2 1 1 0 0 1 0 2 1 0 0 0 0 1 0 1 2 0 0 2 2 1 1 0 0 1 0 1 1 1 1 0 2 1 1 1 1 1 1 1 1 1 1 1 0 0 1 0 1 1 1 2 0 2 1 1 1 0 1 2 2 2 2 1 1 1 1 1 1 0 0 0 0 1 2 2 2 0 2 1 1 0 1 0 1 2 1 1 1 0 1 1 0 0 0 1 2 0 0 1 0 1 1 1 1 1 2 2 2 1 2 1 0 1 2 2 1 2 1 1 2 0 0 0 2 1 0 1 1 0 1 0 1 2 0 2 1 2 ...
output:
0 792 792 792 792 792 792 792 792 792 792 792 792 792 792 792 792 792 792 792 792 792 792 792 792 792 792 792 792 792 792 792 792 792 792 792 792 792 792 792 792 792 792 792 792 792 792 792 792 792 792 792 792 792 792 792 792 792 792 792 792 792 792 792 792 792 792 792 792 792 792 792 792 792 792 79...
result:
ok Accepted
Test #34:
score: 0
Accepted
time: 243ms
memory: 3764kb
input:
992 1 2 2 1 1 2 1 1 1 2 1 0 1 1 1 0 1 0 1 0 1 0 1 1 2 1 1 1 2 0 1 2 1 0 2 1 1 1 1 2 1 0 2 2 2 0 1 1 1 1 1 1 1 0 1 2 1 2 2 1 1 2 1 1 2 2 2 0 2 0 1 2 2 0 1 1 1 0 2 0 0 2 1 0 1 1 2 0 0 2 2 2 2 1 1 2 0 2 0 1 0 1 1 1 2 2 1 2 1 1 1 1 2 1 1 2 1 1 0 0 1 2 1 2 0 1 1 0 0 0 0 1 1 2 1 1 2 0 1 1 2 2 0 0 2 2 1 1 ...
output:
0 585 585 585 585 585 585 585 585 585 585 585 585 585 585 585 585 585 585 585 585 585 585 585 585 585 585 585 585 585 585 585 585 585 585 585 585 585 585 585 585 585 585 585 585 585 585 585 585 585 585 585 585 585 585 585 585 585 585 585 585 585 585 585 585 585 585 585 585 585 585 585 585 585 585 58...
result:
ok Accepted
Test #35:
score: 0
Accepted
time: 226ms
memory: 3820kb
input:
993 2 2 0 1 2 1 2 2 1 1 1 0 1 2 1 1 2 1 1 1 0 1 1 1 2 1 2 0 1 2 1 0 0 0 2 0 2 1 2 1 1 1 1 1 2 0 1 0 1 2 2 0 1 2 1 2 2 0 1 2 1 0 2 1 1 0 1 2 1 0 0 0 0 0 1 0 2 2 1 1 0 2 0 1 1 0 0 1 2 0 1 0 2 0 2 1 1 0 2 0 1 2 1 1 0 2 1 0 0 1 2 0 2 2 2 1 1 1 1 2 1 0 1 1 0 1 1 2 1 0 1 0 1 1 2 1 0 0 1 1 2 0 1 0 0 0 0 1 ...
output:
0 640 640 640 640 640 640 640 640 640 640 640 640 640 640 640 640 640 640 640 640 640 640 640 640 640 640 640 640 640 640 640 640 640 640 640 640 640 640 640 640 640 640 640 640 640 640 640 640 640 640 640 640 640 640 640 640 640 640 640 640 640 640 640 640 640 640 640 640 640 640 640 640 640 640 64...
result:
ok Accepted
Test #36:
score: 0
Accepted
time: 230ms
memory: 3648kb
input:
994 0 1 1 2 2 2 2 1 1 0 0 2 1 2 2 1 1 1 1 1 1 1 2 1 0 1 1 1 1 1 2 0 0 0 2 2 2 1 0 0 2 0 1 0 1 2 0 0 1 1 1 1 1 2 1 2 1 1 1 1 1 2 1 0 1 1 0 1 1 2 2 2 0 2 2 1 1 2 1 0 1 1 1 1 1 2 0 1 1 1 1 1 1 1 2 2 1 0 1 2 1 1 2 0 0 2 1 0 1 0 1 2 1 0 1 0 1 2 1 1 0 2 1 1 2 0 1 1 1 2 1 1 1 1 1 2 1 2 1 1 0 2 1 1 1 1 2 1 ...
output:
0 547 547 547 547 547 547 547 547 547 547 547 547 547 547 547 547 547 547 547 547 547 547 547 547 547 547 547 547 547 547 547 547 547 547 547 547 547 547 547 547 547 547 547 547 547 547 547 547 547 547 547 547 547 547 547 547 547 547 547 547 547 547 547 547 547 547 547 547 547 547 547 547 547 547 54...
result:
ok Accepted
Test #37:
score: 0
Accepted
time: 240ms
memory: 3712kb
input:
995 1 0 1 1 1 1 1 1 2 2 0 2 0 2 0 1 2 2 2 1 2 2 1 0 2 2 1 1 1 0 1 1 1 2 0 1 2 1 0 1 0 1 1 1 0 1 0 2 2 2 0 1 1 1 2 2 2 1 1 0 1 0 2 1 0 0 1 0 1 0 1 1 1 1 2 2 0 1 2 1 0 1 1 1 0 2 1 1 1 0 1 0 2 1 0 2 1 1 1 2 0 1 1 2 1 0 1 0 1 0 0 0 1 2 2 2 1 1 0 0 2 2 1 1 1 2 2 1 1 1 2 0 2 1 1 2 0 1 1 0 0 0 2 1 1 1 2 1 ...
output:
0 330 330 330 330 330 330 330 330 330 330 330 330 330 330 330 330 330 330 330 330 330 330 330 330 330 330 330 330 330 330 330 330 330 330 330 330 330 330 330 330 330 330 330 330 330 330 330 330 330 330 330 330 330 330 330 330 330 330 330 330 330 330 330 330 330 330 330 330 330 330 330 330 330 330 33...
result:
ok Accepted
Test #38:
score: 0
Accepted
time: 222ms
memory: 3684kb
input:
996 2 1 1 1 1 1 2 2 2 0 1 1 1 2 0 2 0 1 1 1 0 1 1 1 1 1 0 0 1 0 1 1 2 2 0 1 2 2 1 1 1 1 1 2 1 1 0 2 0 2 0 2 0 2 1 0 2 2 1 1 0 1 0 1 1 1 1 1 1 0 1 0 1 0 2 0 1 1 1 0 1 2 1 1 2 1 0 1 2 1 1 1 1 1 2 2 1 0 1 0 1 1 0 2 2 2 1 1 2 2 1 1 1 2 2 1 0 2 0 2 1 0 2 2 2 0 2 2 1 0 1 2 0 2 1 0 2 2 0 1 2 0 1 0 0 2 1 1 ...
output:
0 458 458 458 458 458 458 458 458 458 458 458 458 458 458 458 458 458 458 458 458 458 458 458 458 458 458 458 458 458 458 458 458 458 458 458 458 458 458 458 458 458 458 458 458 458 458 458 458 458 458 458 458 458 458 458 458 458 458 458 458 458 458 458 458 458 458 458 458 458 458 458 458 458 458 45...
result:
ok Accepted
Test #39:
score: 0
Accepted
time: 238ms
memory: 3764kb
input:
997 1 1 2 2 0 0 2 2 2 1 2 1 1 1 0 2 1 1 1 2 2 0 1 1 1 1 1 0 1 2 1 1 1 2 0 1 0 0 1 1 0 1 1 0 1 1 0 1 2 1 1 1 1 0 1 1 2 1 1 1 2 2 2 0 1 0 1 0 1 1 1 2 2 0 0 0 0 0 1 2 2 2 1 2 1 0 1 2 1 1 2 1 1 1 0 1 1 1 1 1 0 1 2 1 0 1 1 1 2 1 1 2 1 1 1 1 2 1 2 1 1 1 1 2 0 2 1 2 1 0 0 1 2 0 1 0 1 1 1 2 1 1 0 1 2 1 1 0 ...
output:
0 617 617 617 617 617 617 617 617 617 617 617 617 617 617 617 617 617 617 617 617 617 617 617 617 617 617 617 617 617 617 617 617 617 617 617 617 617 617 617 617 617 617 617 617 617 617 617 617 617 617 617 617 617 617 617 617 617 617 617 617 617 617 617 617 617 617 617 617 617 617 617 617 617 617 61...
result:
ok Accepted
Test #40:
score: 0
Accepted
time: 226ms
memory: 3764kb
input:
998 1 2 1 0 1 1 0 2 1 1 0 1 1 0 1 0 1 1 1 1 1 2 1 1 1 2 1 0 1 2 0 0 1 1 1 0 0 1 0 2 1 1 0 1 1 1 0 0 1 2 1 2 2 2 1 1 0 0 1 2 1 1 1 2 2 2 1 2 2 0 0 1 1 1 0 1 1 2 2 2 1 1 1 0 2 0 1 0 1 1 1 1 1 2 1 2 0 1 2 0 1 0 1 0 0 1 2 2 0 0 1 1 0 0 1 0 1 2 1 1 1 1 0 1 2 1 1 1 2 1 1 0 2 0 2 1 1 0 1 2 1 1 1 1 1 0 1 0 ...
output:
0 539 539 539 539 539 539 539 539 539 539 539 539 539 539 539 539 539 539 539 539 539 539 539 539 539 539 539 539 539 539 539 539 539 539 539 539 539 539 539 539 539 539 539 539 539 539 539 539 539 539 539 539 539 539 539 539 539 539 539 539 539 539 539 539 539 539 539 539 539 539 539 539 539 539 53...
result:
ok Accepted
Test #41:
score: 0
Accepted
time: 239ms
memory: 3764kb
input:
999 1 0 1 1 1 1 2 1 1 0 1 0 1 1 2 2 0 0 1 2 0 1 1 1 2 2 1 2 2 2 2 1 1 1 2 1 2 1 1 0 0 0 1 1 0 1 1 2 1 1 2 0 2 2 0 1 2 0 2 2 1 2 1 2 0 1 2 1 0 1 1 1 1 1 2 1 1 2 0 1 0 2 0 1 1 2 1 0 1 0 2 1 1 1 1 2 0 1 1 1 1 0 1 0 2 1 2 0 0 2 0 2 1 2 1 2 1 1 0 0 1 1 1 1 1 1 0 1 2 0 2 2 0 0 1 0 1 1 1 2 0 2 1 1 1 0 1 2 ...
output:
0 328 328 328 328 328 328 328 328 328 328 328 328 328 328 328 328 328 328 328 328 328 328 328 328 328 328 328 328 328 328 328 328 328 328 328 328 328 328 328 328 328 328 328 328 328 328 328 328 328 328 328 328 328 328 328 328 328 328 328 328 328 328 328 328 328 328 328 328 328 328 328 328 328 328 32...
result:
ok Accepted
Extra Test:
score: 0
Extra Test Passed