QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#599905 | #9432. Permutation | tarjen | AC ✓ | 324ms | 3956kb | C++20 | 4.1kb | 2024-09-29 13:03:00 | 2024-09-29 13:03:01 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
int rnd(int B=2) {
return (unsigned long long)rng() % B;
}
const bool rand_test=false;
struct Interactor{
int n;
vector<int> a;
int tot=0;
void init(int _n){
n=_n;
tot=0;
if(rand_test){
a.resize(n+1);
for(int i=1;i<=n;i++)a[i]=i;
random_shuffle(a.begin()+1,a.end());
cout<<"random_a : ";for(int i=1;i<=n;i++)cout<<a[i]<<" ";;cout<<endl;
}
}
int query(vector<int> b){
tot++;
assert(tot<=6666);
cout<<"0 "<<b[1];
for(int i=2;i<=n;i++)cout<<" "<<b[i];
cout<<endl;
if(rand_test){
int cnt=0;
for(int i=1;i<=n;i++)cnt+=(a[i]==b[i]);
return cnt;
}
int z;cin>>z;return z;
}
void answer(vector<int>b){
cout<<"1 "<<b[1];
for(int i=2;i<=n;i++)cout<<" "<<b[i];
cout<<endl;
if(rand_test){
int cnt=0;
for(int i=1;i<=n;i++)cnt+=(a[i]==b[i]);
assert(cnt==n);
cout<<"tot="<<tot<<endl;
}
}
}sol;
int solve()
{
srand(time(NULL));
int n;
if(rand_test)n=1000;
else cin>>n;
sol.init(n);
if(n<=5){
vector<int>ans(n+1);
iota(ans.begin(),ans.end(),0);
do{
if(sol.query(ans)==n){
sol.answer(ans);
return 0;
}
}while(next_permutation(ans.begin()+1,ans.end()));
return 0;
}
// int zero=2;
// for(int i=1;i<=n;i++)if(i!=2){
// vector<int> b(n+1);
// b[1]=i;
// for(int j=2;j<=n;j++)b[j]=2;
// int q=sol.query(b);
// if(q==0)break;
// if(q==2){zero=i;break;}
// }
vector<int>ans(n+1);
// ans[1]=zero;
// cout<<"zero = "<<zero<<endl;
auto zero = [&](int a,int b){
for(int i=1;i<=n;i++)if(i!=a&&i!=b)return i;
return -1;
};
function<void(int,int,vector<int>)> dfs = [&](int l,int r,vector<int>a){
random_shuffle(a.begin(),a.end());
// cout<<"dfs l ="<<l<<" r="<<r<<" a :";for(auto it:a)cout<<it<<" ";;;cout<<endl;
if(r-l+1==1){
ans[l]=a.back();
return;
}
if(r-l+1==2){
vector<int>b(n+1,a[0]);
b[r]=zero(a[0],a[1]);
if(sol.query(b)==1){
ans[l]=a[0],ans[r]=a[1];
}
else ans[l]=a[1],ans[r]=a[0];
return;
}
int mid=(l+r)/2;
vector<int>L,R;
vector<int> v;
for(int i=0;i<(int)a.size();i++){
v.push_back(a[i]);
while(i+1<a.size()){
int t[2]={v.back(),a[i+1]};
vector<int> b(n+1);
for(int j=1;j<=n;j++){
if(j>=l&&j<=mid)b[j]=t[0];
else if(j>mid&&j<=r)b[j]=t[1];
else b[j]=t[0];
}
int q=sol.query(b);
if(q==2){
for(auto it:v)L.push_back(it);
R.push_back(t[1]);
v.clear();
i++;
break;
}
else if(q==0){
L.push_back(t[1]);
for(auto it:v)R.push_back(it);
v.clear();
i++;
break;
}
else{
v.push_back(a[i+1]);
i++;
}
}
}
if(!v.empty()){
if(L.size()<mid-l+1){
for(auto it:v)L.push_back(it);
}
else {
for(auto it:v)R.push_back(it);
}
}
dfs(l,mid,L);
dfs(mid+1,r,R);
};
vector<int> b(n);iota(b.begin(),b.end(),1);
dfs(1,n,b);
sol.answer(ans);
return 0;
}
int main()
{
int T=1;;
while(T--)solve();
}
詳細信息
Test #1:
score: 100
Accepted
time: 0ms
memory: 3676kb
input:
5 1 0 1 0 0 0 2 1 1 0 0 0 3 2 2 1 1 1 1 1 0 0 0 0 1 0 1 0 0 0 1 0 2 0 1 0 2 1 3 1 2 1 0 0 1 0 1 0 3 2 2 1 1 1 2 1 3 1 2 1 3 2 5
output:
0 1 2 3 4 5 0 1 2 3 5 4 0 1 2 4 3 5 0 1 2 4 5 3 0 1 2 5 3 4 0 1 2 5 4 3 0 1 3 2 4 5 0 1 3 2 5 4 0 1 3 4 2 5 0 1 3 4 5 2 0 1 3 5 2 4 0 1 3 5 4 2 0 1 4 2 3 5 0 1 4 2 5 3 0 1 4 3 2 5 0 1 4 3 5 2 0 1 4 5 2 3 0 1 4 5 3 2 0 1 5 2 3 4 0 1 5 2 4 3 0 1 5 3 2 4 0 1 5 3 4 2 0 1 5 4 2 3 0 1 5 4 3 2 0 2 1 3 4 5 ...
result:
ok Accepted
Test #2:
score: 0
Accepted
time: 299ms
memory: 3652kb
input:
1000 1 0 0 0 1 2 0 1 2 1 2 1 2 2 1 0 1 1 1 0 2 2 0 1 0 1 1 1 0 1 2 1 1 1 1 0 0 2 1 2 0 0 0 0 2 2 1 1 0 1 2 1 0 0 0 1 2 1 1 2 1 1 1 2 2 0 2 1 2 2 0 1 1 0 1 0 2 1 1 2 1 1 1 1 0 1 1 1 0 2 1 2 0 0 1 0 1 1 1 1 1 1 1 2 1 2 1 2 1 0 1 1 1 2 2 0 0 1 1 1 1 2 1 2 0 1 0 2 2 0 2 0 1 1 1 1 2 1 1 2 0 1 0 1 1 0 2 0...
output:
0 664 664 664 664 664 664 664 664 664 664 664 664 664 664 664 664 664 664 664 664 664 664 664 664 664 664 664 664 664 664 664 664 664 664 664 664 664 664 664 664 664 664 664 664 664 664 664 664 664 664 664 664 664 664 664 664 664 664 664 664 664 664 664 664 664 664 664 664 664 664 664 664 664 664 66...
result:
ok Accepted
Test #3:
score: 0
Accepted
time: 1ms
memory: 3940kb
input:
1 1
output:
0 1 1 1
result:
ok Accepted
Test #4:
score: 0
Accepted
time: 0ms
memory: 3716kb
input:
2 0 2
output:
0 1 2 0 2 1 1 2 1
result:
ok Accepted
Test #5:
score: 0
Accepted
time: 0ms
memory: 3620kb
input:
3 0 1 1 0 3
output:
0 1 2 3 0 1 3 2 0 2 1 3 0 2 3 1 0 3 1 2 1 3 1 2
result:
ok Accepted
Test #6:
score: 0
Accepted
time: 1ms
memory: 3676kb
input:
4 0 0 1 0 2 1 0 0 0 1 1 2 2 1 1 2 2 4
output:
0 1 2 3 4 0 1 2 4 3 0 1 3 2 4 0 1 3 4 2 0 1 4 2 3 0 1 4 3 2 0 2 1 3 4 0 2 1 4 3 0 2 3 1 4 0 2 3 4 1 0 2 4 1 3 0 2 4 3 1 0 3 1 2 4 0 3 1 4 2 0 3 2 1 4 0 3 2 4 1 0 3 4 1 2 0 3 4 2 1 1 3 4 2 1
result:
ok Accepted
Test #7:
score: 0
Accepted
time: 1ms
memory: 3944kb
input:
6 0 1 0 1 2 1 1 2 0
output:
0 1 1 1 3 3 3 0 5 5 5 6 6 6 0 6 6 6 2 2 2 0 3 3 4 3 3 3 0 4 4 2 4 4 4 0 3 1 3 3 3 3 0 1 1 1 1 1 6 0 6 6 6 6 6 5 0 6 6 6 6 2 6 1 3 4 2 1 6 5
result:
ok Accepted
Test #8:
score: 0
Accepted
time: 1ms
memory: 3816kb
input:
7 1 2 0 0 0 2 1 1 2 0
output:
0 1 1 1 1 3 3 3 0 3 3 3 3 5 5 5 0 6 6 6 6 7 7 7 0 4 4 4 4 2 2 2 0 1 1 7 7 1 1 1 0 3 3 2 2 3 3 3 0 3 1 3 3 3 3 3 0 2 2 2 3 2 2 2 0 6 6 6 6 6 6 4 0 5 5 5 5 5 1 5 1 3 7 2 1 6 5 4
result:
ok Accepted
Test #9:
score: 0
Accepted
time: 1ms
memory: 3692kb
input:
8 1 2 0 0 0 0 0 1 0 0 0 1
output:
0 1 1 1 1 3 3 3 3 0 3 3 3 3 5 5 5 5 0 6 6 6 6 7 7 7 7 0 8 8 8 8 2 2 2 2 0 1 1 3 3 1 1 1 1 0 2 2 7 7 2 2 2 2 0 7 1 7 7 7 7 7 7 0 2 2 2 3 2 2 2 2 0 8 8 8 8 8 8 6 6 0 4 4 4 4 4 4 5 5 0 5 5 5 5 5 1 5 5 0 4 4 4 4 4 4 4 1 1 3 7 2 1 6 5 4 8
result:
ok Accepted
Test #10:
score: 0
Accepted
time: 1ms
memory: 3684kb
input:
9 1 2 0 0 2 1 1 2 1 2 0 1 1 2 0 0
output:
0 1 1 1 1 1 3 3 3 3 0 3 3 3 3 3 5 5 5 5 0 6 6 6 6 6 7 7 7 7 0 8 8 8 8 8 2 2 2 2 0 9 9 9 9 9 4 4 4 4 0 2 2 2 7 7 2 2 2 2 0 7 7 7 3 3 7 7 7 7 0 3 3 3 9 9 3 3 3 3 0 3 3 7 3 3 3 3 3 3 0 7 7 2 7 7 7 7 7 7 0 7 1 7 7 7 7 7 7 7 0 1 1 1 1 2 1 1 1 1 0 4 4 4 4 4 4 4 5 5 0 5 5 5 5 5 5 5 6 6 0 4 4 4 4 4 4 1 4 4 ...
result:
ok Accepted
Test #11:
score: 0
Accepted
time: 1ms
memory: 3692kb
input:
10 1 2 0 1 0 0 2 1 2 0 1 1 0 2 0 0 0
output:
0 1 1 1 1 1 3 3 3 3 3 0 3 3 3 3 3 5 5 5 5 5 0 6 6 6 6 6 7 7 7 7 7 0 8 8 8 8 8 2 2 2 2 2 0 2 2 2 2 2 10 10 10 10 10 0 4 4 4 4 4 9 9 9 9 9 0 7 7 7 9 9 7 7 7 7 7 0 10 10 10 3 3 10 10 10 10 10 0 3 3 3 1 1 3 3 3 3 3 0 10 10 7 10 10 10 10 10 10 10 0 3 1 3 3 3 3 3 3 3 3 0 1 1 1 1 2 1 1 1 1 1 0 6 6 6 6 6 6 ...
result:
ok Accepted
Test #12:
score: 0
Accepted
time: 1ms
memory: 3616kb
input:
11 0 2 2 0 0 0 1 0 2 0 2 0 2 1 2 2 0 1
output:
0 11 11 11 11 11 11 3 3 3 3 3 0 5 5 5 5 5 5 6 6 6 6 6 0 7 7 7 7 7 7 8 8 8 8 8 0 2 2 2 2 2 2 10 10 10 10 10 0 4 4 4 4 4 4 9 9 9 9 9 0 5 5 5 10 10 10 5 5 5 5 5 0 1 1 1 9 9 9 1 1 1 1 1 0 9 9 9 7 7 7 9 9 9 9 9 0 3 3 10 3 3 3 3 3 3 3 3 0 7 1 7 7 7 7 7 7 7 7 7 0 9 9 9 9 9 5 9 9 9 9 9 0 9 9 9 9 2 9 9 9 9 9...
result:
ok Accepted
Test #13:
score: 0
Accepted
time: 1ms
memory: 3612kb
input:
12 0 2 2 0 0 2 1 2 1 0 2 0 1 2 1 2 1 2 1 2 1 2 1
output:
0 12 12 12 12 12 12 3 3 3 3 3 3 0 5 5 5 5 5 5 6 6 6 6 6 6 0 7 7 7 7 7 7 8 8 8 8 8 8 0 2 2 2 2 2 2 10 10 10 10 10 10 0 4 4 4 4 4 4 9 9 9 9 9 9 0 1 1 1 1 1 1 11 11 11 11 11 11 0 10 10 10 7 7 7 10 10 10 10 10 10 0 7 7 7 9 9 9 7 7 7 7 7 7 0 5 5 5 1 1 1 5 5 5 5 5 5 0 1 1 1 3 3 3 1 1 1 1 1 1 0 3 3 10 3 3 ...
result:
ok Accepted
Test #14:
score: 0
Accepted
time: 1ms
memory: 3528kb
input:
13 1 0 0 1 0 1 1 2 0 0 0 0 2 1 1 2 0 0 0 0 1 2 0 0 0
output:
0 12 12 12 12 12 12 12 3 3 3 3 3 3 0 3 3 3 3 3 3 3 5 5 5 5 5 5 0 6 6 6 6 6 6 6 7 7 7 7 7 7 0 8 8 8 8 8 8 8 2 2 2 2 2 2 0 2 2 2 2 2 2 2 10 10 10 10 10 10 0 4 4 4 4 4 4 4 13 13 13 13 13 13 0 13 13 13 13 13 13 13 1 1 1 1 1 1 0 1 1 1 1 1 1 1 11 11 11 11 11 11 0 9 9 9 9 7 7 7 9 9 9 9 9 9 0 4 4 4 4 13 13 ...
result:
ok Accepted
Test #15:
score: 0
Accepted
time: 0ms
memory: 3680kb
input:
14 1 1 0 2 0 1 1 2 2 2 0 1 2 0 2 1 0 0 1 0 1 0 1 0 2 0 1 2 1
output:
0 12 12 12 12 12 12 12 3 3 3 3 3 3 3 0 3 3 3 3 3 3 3 5 5 5 5 5 5 5 0 5 5 5 5 5 5 5 14 14 14 14 14 14 14 0 7 7 7 7 7 7 7 8 8 8 8 8 8 8 0 2 2 2 2 2 2 2 10 10 10 10 10 10 10 0 4 4 4 4 4 4 4 13 13 13 13 13 13 13 0 13 13 13 13 13 13 13 1 1 1 1 1 1 1 0 1 1 1 1 1 1 1 11 11 11 11 11 11 11 0 9 9 9 9 9 9 9 6 ...
result:
ok Accepted
Test #16:
score: 0
Accepted
time: 1ms
memory: 3684kb
input:
15 1 1 0 2 0 1 1 1 1 2 1 1 2 2 1 0 0 1 0 0 0 0 1 0 0 1 2 1 0 0 1 1 2 0
output:
0 12 12 12 12 12 12 12 12 3 3 3 3 3 3 3 0 3 3 3 3 3 3 3 3 5 5 5 5 5 5 5 0 5 5 5 5 5 5 5 5 15 15 15 15 15 15 15 0 7 7 7 7 7 7 7 7 8 8 8 8 8 8 8 0 2 2 2 2 2 2 2 2 10 10 10 10 10 10 10 0 4 4 4 4 4 4 4 4 13 13 13 13 13 13 13 0 13 13 13 13 13 13 13 13 1 1 1 1 1 1 1 0 1 1 1 1 1 1 1 1 11 11 11 11 11 11 11 ...
result:
ok Accepted
Test #17:
score: 0
Accepted
time: 287ms
memory: 3684kb
input:
975 1 0 1 2 1 2 0 1 1 1 1 0 2 2 2 2 0 0 1 1 0 0 1 1 2 0 1 1 0 1 2 0 2 1 0 2 1 0 2 2 1 2 2 0 1 1 0 1 1 0 0 1 1 1 1 1 1 0 1 1 1 1 1 1 1 2 1 1 1 1 0 1 1 2 1 0 0 0 1 1 0 0 1 2 0 2 1 1 1 2 0 1 1 2 1 0 1 1 2 1 1 2 2 2 0 2 1 2 0 1 0 2 1 1 2 2 2 2 0 0 1 1 0 1 1 1 1 2 2 1 1 1 1 1 1 1 1 1 1 0 1 1 0 2 2 0 1 2 ...
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 #18:
score: 0
Accepted
time: 288ms
memory: 3652kb
input:
976 1 1 0 1 1 0 2 1 0 2 1 2 1 2 2 1 0 1 1 2 1 0 0 1 0 2 0 1 1 1 0 0 1 2 0 1 1 1 1 1 0 2 1 1 1 2 1 1 1 0 0 0 2 0 0 0 1 1 1 0 1 2 2 1 2 0 2 2 0 0 1 1 1 0 0 1 2 1 2 0 1 2 1 1 1 0 1 1 2 1 1 1 1 1 1 1 2 0 2 0 1 1 1 0 2 2 1 0 1 0 2 0 1 1 1 1 1 0 1 1 1 1 0 1 1 1 2 2 1 2 0 1 0 0 1 1 1 1 2 0 1 0 1 1 1 2 1 1 ...
output:
0 344 344 344 344 344 344 344 344 344 344 344 344 344 344 344 344 344 344 344 344 344 344 344 344 344 344 344 344 344 344 344 344 344 344 344 344 344 344 344 344 344 344 344 344 344 344 344 344 344 344 344 344 344 344 344 344 344 344 344 344 344 344 344 344 344 344 344 344 344 344 344 344 344 344 34...
result:
ok Accepted
Test #19:
score: 0
Accepted
time: 279ms
memory: 3656kb
input:
977 1 0 1 0 1 1 1 0 1 0 0 1 0 2 2 2 1 1 1 1 1 0 2 2 0 1 0 0 1 1 1 1 1 1 0 2 2 0 0 2 1 1 1 0 0 0 1 2 2 1 2 2 1 1 1 1 1 2 1 2 1 1 0 0 1 1 1 1 1 1 2 1 1 2 1 1 2 1 0 0 2 1 1 1 2 1 0 0 0 0 2 2 1 2 1 1 2 1 2 0 2 0 1 1 1 1 2 1 2 1 0 1 1 0 1 0 1 1 1 1 0 1 1 2 1 1 1 1 2 1 2 1 2 1 0 1 1 2 1 1 1 1 1 2 2 1 0 0 ...
output:
0 364 364 364 364 364 364 364 364 364 364 364 364 364 364 364 364 364 364 364 364 364 364 364 364 364 364 364 364 364 364 364 364 364 364 364 364 364 364 364 364 364 364 364 364 364 364 364 364 364 364 364 364 364 364 364 364 364 364 364 364 364 364 364 364 364 364 364 364 364 364 364 364 364 364 36...
result:
ok Accepted
Test #20:
score: 0
Accepted
time: 294ms
memory: 3948kb
input:
978 0 1 0 2 2 2 2 1 2 1 1 1 1 0 2 2 1 1 2 2 2 2 2 1 1 2 2 1 1 1 1 2 1 1 2 1 1 2 0 0 2 1 1 2 1 0 1 0 1 2 1 1 0 1 1 0 2 1 0 1 1 1 2 1 2 1 1 1 1 1 0 1 1 1 1 2 1 1 1 0 2 1 1 2 1 2 1 2 1 0 1 2 0 1 1 2 1 1 0 1 2 0 2 1 0 0 1 1 1 1 1 2 1 0 2 1 1 2 2 1 2 1 0 0 0 1 1 1 1 0 2 1 1 0 1 0 0 2 0 1 2 1 1 1 1 1 1 0 ...
output:
0 447 447 447 447 447 447 447 447 447 447 447 447 447 447 447 447 447 447 447 447 447 447 447 447 447 447 447 447 447 447 447 447 447 447 447 447 447 447 447 447 447 447 447 447 447 447 447 447 447 447 447 447 447 447 447 447 447 447 447 447 447 447 447 447 447 447 447 447 447 447 447 447 447 447 44...
result:
ok Accepted
Test #21:
score: 0
Accepted
time: 274ms
memory: 3720kb
input:
979 0 0 2 1 1 1 1 0 1 1 1 1 1 0 0 1 1 1 1 1 0 1 2 0 1 0 1 2 0 1 1 0 2 1 1 1 1 0 0 1 1 1 0 1 1 0 0 0 1 1 1 2 0 2 1 2 0 1 1 0 1 0 1 0 2 1 1 1 1 1 1 1 2 2 1 1 1 2 2 1 1 1 1 0 1 0 1 0 1 1 1 1 1 1 1 2 1 1 1 1 0 1 1 0 1 2 1 1 0 1 0 2 1 1 1 1 0 0 1 2 0 1 0 1 0 0 2 1 1 1 1 1 0 1 2 1 2 2 1 2 1 1 1 0 2 2 1 1 ...
output:
0 428 428 428 428 428 428 428 428 428 428 428 428 428 428 428 428 428 428 428 428 428 428 428 428 428 428 428 428 428 428 428 428 428 428 428 428 428 428 428 428 428 428 428 428 428 428 428 428 428 428 428 428 428 428 428 428 428 428 428 428 428 428 428 428 428 428 428 428 428 428 428 428 428 428 42...
result:
ok Accepted
Test #22:
score: 0
Accepted
time: 289ms
memory: 3948kb
input:
980 1 2 1 1 1 0 1 2 0 1 0 2 1 1 1 1 2 2 2 1 0 0 0 2 1 0 1 1 0 1 1 0 0 0 1 0 1 0 0 1 1 2 1 0 2 1 2 1 1 0 0 0 0 1 2 0 2 1 1 1 0 2 2 1 1 1 1 0 1 1 2 1 2 1 0 2 2 2 1 2 1 0 1 1 1 1 1 2 2 1 1 1 2 2 1 1 2 2 1 0 2 1 1 1 2 1 1 2 0 1 2 2 2 1 1 0 2 1 2 0 2 1 1 1 0 1 1 1 2 0 1 1 1 1 1 1 1 1 2 1 1 0 1 1 1 2 1 2 ...
output:
0 773 773 773 773 773 773 773 773 773 773 773 773 773 773 773 773 773 773 773 773 773 773 773 773 773 773 773 773 773 773 773 773 773 773 773 773 773 773 773 773 773 773 773 773 773 773 773 773 773 773 773 773 773 773 773 773 773 773 773 773 773 773 773 773 773 773 773 773 773 773 773 773 773 773 77...
result:
ok Accepted
Test #23:
score: 0
Accepted
time: 271ms
memory: 3696kb
input:
981 1 0 1 0 1 1 1 0 2 1 2 1 1 0 2 0 1 1 0 1 0 1 2 0 1 1 0 2 1 1 2 1 1 1 1 2 0 1 1 1 0 0 1 1 2 0 1 0 1 2 2 0 2 1 2 1 1 2 1 0 2 1 1 1 1 0 0 1 0 1 2 1 2 1 1 1 2 1 2 1 1 1 1 0 0 2 1 1 1 1 1 0 1 1 2 1 1 1 2 1 0 0 0 1 0 2 1 2 1 1 0 1 0 2 0 1 1 0 1 2 0 1 1 1 1 1 2 0 1 1 2 0 1 0 1 1 1 0 0 1 1 2 0 0 1 1 1 1 ...
output:
0 344 344 344 344 344 344 344 344 344 344 344 344 344 344 344 344 344 344 344 344 344 344 344 344 344 344 344 344 344 344 344 344 344 344 344 344 344 344 344 344 344 344 344 344 344 344 344 344 344 344 344 344 344 344 344 344 344 344 344 344 344 344 344 344 344 344 344 344 344 344 344 344 344 344 34...
result:
ok Accepted
Test #24:
score: 0
Accepted
time: 273ms
memory: 3684kb
input:
982 1 1 2 1 0 1 0 2 0 1 0 1 2 1 0 2 1 0 0 2 1 0 0 0 1 1 1 0 0 2 1 2 2 1 1 2 2 2 2 1 0 1 2 2 1 1 1 1 2 1 0 2 0 2 1 1 2 2 1 1 0 2 1 1 1 0 1 0 1 0 1 1 0 0 1 1 1 1 2 2 2 0 1 2 2 1 1 1 1 1 1 2 1 1 0 2 1 1 1 1 1 0 1 1 1 1 0 0 0 1 1 0 2 1 2 1 1 1 0 0 0 1 1 2 1 1 1 0 1 0 0 2 2 1 0 2 0 1 0 0 2 1 1 1 1 0 1 2 ...
output:
0 81 81 81 81 81 81 81 81 81 81 81 81 81 81 81 81 81 81 81 81 81 81 81 81 81 81 81 81 81 81 81 81 81 81 81 81 81 81 81 81 81 81 81 81 81 81 81 81 81 81 81 81 81 81 81 81 81 81 81 81 81 81 81 81 81 81 81 81 81 81 81 81 81 81 81 81 81 81 81 81 81 81 81 81 81 81 81 81 81 81 81 81 81 81 81 81 81 81 81 8...
result:
ok Accepted
Test #25:
score: 0
Accepted
time: 307ms
memory: 3728kb
input:
983 1 1 1 1 0 2 1 2 1 1 1 0 1 0 0 1 0 2 2 0 1 1 1 1 1 0 0 1 0 2 0 0 1 1 1 0 1 0 1 1 2 1 0 2 1 0 1 1 2 1 1 1 0 2 0 1 0 2 0 2 1 0 1 1 1 1 0 0 2 0 1 1 2 1 1 2 0 2 0 1 2 2 0 0 1 1 1 2 1 1 1 2 1 0 1 0 2 1 2 0 1 2 0 0 1 0 1 1 0 0 1 0 0 1 1 1 1 1 1 0 2 0 0 0 0 1 2 2 1 1 1 0 2 1 2 1 1 1 1 0 1 1 2 2 2 1 2 0 ...
output:
0 325 325 325 325 325 325 325 325 325 325 325 325 325 325 325 325 325 325 325 325 325 325 325 325 325 325 325 325 325 325 325 325 325 325 325 325 325 325 325 325 325 325 325 325 325 325 325 325 325 325 325 325 325 325 325 325 325 325 325 325 325 325 325 325 325 325 325 325 325 325 325 325 325 325 32...
result:
ok Accepted
Test #26:
score: 0
Accepted
time: 275ms
memory: 3648kb
input:
984 1 1 1 0 1 0 1 1 1 1 0 1 2 2 1 2 2 2 0 0 0 2 2 1 1 1 1 2 1 1 1 1 1 2 2 1 0 1 1 1 1 1 0 1 1 1 0 1 2 1 2 1 0 1 2 2 1 1 1 1 0 1 1 2 0 2 2 1 1 1 1 1 2 1 1 1 1 1 2 0 2 2 1 1 1 1 0 1 2 1 1 1 0 1 1 1 0 0 1 1 2 1 2 2 0 2 2 0 2 1 1 1 1 2 1 0 0 0 1 1 0 2 1 2 2 1 0 1 1 1 0 2 2 1 1 0 1 1 2 1 1 2 1 1 2 1 1 0 ...
output:
0 714 714 714 714 714 714 714 714 714 714 714 714 714 714 714 714 714 714 714 714 714 714 714 714 714 714 714 714 714 714 714 714 714 714 714 714 714 714 714 714 714 714 714 714 714 714 714 714 714 714 714 714 714 714 714 714 714 714 714 714 714 714 714 714 714 714 714 714 714 714 714 714 714 714 71...
result:
ok Accepted
Test #27:
score: 0
Accepted
time: 297ms
memory: 3692kb
input:
985 1 0 0 1 2 0 0 1 0 1 1 1 2 1 0 1 2 1 0 0 1 2 0 2 1 2 2 1 1 1 1 1 2 2 0 2 1 1 1 1 2 0 1 1 1 1 1 0 1 1 2 1 1 1 0 1 1 1 1 0 1 2 1 1 2 0 1 1 2 0 1 1 2 1 0 2 2 1 0 2 0 1 1 0 1 1 2 1 0 1 2 1 1 2 1 0 2 1 1 2 1 2 1 1 1 1 2 1 1 1 1 2 0 1 2 1 1 0 1 2 0 0 2 0 1 1 1 0 2 0 1 1 2 1 1 2 2 1 0 1 1 2 1 1 1 1 2 2 ...
output:
0 467 467 467 467 467 467 467 467 467 467 467 467 467 467 467 467 467 467 467 467 467 467 467 467 467 467 467 467 467 467 467 467 467 467 467 467 467 467 467 467 467 467 467 467 467 467 467 467 467 467 467 467 467 467 467 467 467 467 467 467 467 467 467 467 467 467 467 467 467 467 467 467 467 467 46...
result:
ok Accepted
Test #28:
score: 0
Accepted
time: 290ms
memory: 3956kb
input:
986 1 2 1 0 1 2 2 0 0 2 1 0 1 1 2 0 1 0 1 2 0 0 1 2 0 1 1 0 1 2 1 2 1 1 2 1 0 0 1 1 2 1 1 1 1 1 0 1 1 0 2 1 1 2 0 0 2 1 0 0 1 1 1 1 1 0 1 0 2 1 1 2 2 1 2 1 2 0 1 1 1 2 1 0 1 1 2 2 0 2 1 1 0 1 1 2 1 1 0 0 0 0 0 2 0 2 0 1 2 2 2 1 1 1 0 0 1 2 2 0 1 2 1 0 1 2 0 0 2 2 2 1 1 1 1 2 0 0 0 1 2 2 1 0 2 1 0 2 ...
output:
0 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 ...
result:
ok Accepted
Test #29:
score: 0
Accepted
time: 288ms
memory: 3724kb
input:
987 1 0 1 2 1 0 2 1 1 0 1 2 0 0 0 1 1 1 1 1 2 1 1 1 0 2 2 1 1 0 1 2 0 2 1 1 1 1 1 1 1 2 2 1 0 1 1 1 0 2 1 0 2 2 1 0 2 1 2 1 2 2 0 1 1 1 2 1 0 1 1 1 1 0 1 0 2 0 1 2 2 1 2 0 1 1 2 1 1 0 1 1 0 1 2 2 0 2 0 1 0 1 1 1 2 0 2 1 1 1 0 1 1 0 0 2 2 0 2 0 2 2 2 2 0 0 1 1 2 1 2 1 1 2 1 1 0 1 1 2 2 1 1 1 1 2 1 1 ...
output:
0 560 560 560 560 560 560 560 560 560 560 560 560 560 560 560 560 560 560 560 560 560 560 560 560 560 560 560 560 560 560 560 560 560 560 560 560 560 560 560 560 560 560 560 560 560 560 560 560 560 560 560 560 560 560 560 560 560 560 560 560 560 560 560 560 560 560 560 560 560 560 560 560 560 560 56...
result:
ok Accepted
Test #30:
score: 0
Accepted
time: 285ms
memory: 3652kb
input:
988 1 2 2 0 1 1 2 1 1 0 1 2 0 1 1 1 1 1 1 1 1 1 0 1 1 0 1 2 1 2 1 2 1 1 1 1 0 1 2 0 2 2 2 1 0 0 0 1 1 1 2 2 2 1 2 2 0 0 1 1 0 1 1 1 1 1 1 0 0 1 1 1 0 1 1 1 1 2 2 0 2 1 2 1 1 1 1 2 2 1 2 1 1 2 1 1 1 1 0 2 0 1 2 2 2 1 2 2 0 0 2 0 1 2 1 1 1 2 0 0 0 2 1 0 1 2 0 1 1 2 1 1 1 0 0 0 1 0 1 2 1 0 1 0 2 1 2 1 ...
output:
0 434 434 434 434 434 434 434 434 434 434 434 434 434 434 434 434 434 434 434 434 434 434 434 434 434 434 434 434 434 434 434 434 434 434 434 434 434 434 434 434 434 434 434 434 434 434 434 434 434 434 434 434 434 434 434 434 434 434 434 434 434 434 434 434 434 434 434 434 434 434 434 434 434 434 43...
result:
ok Accepted
Test #31:
score: 0
Accepted
time: 280ms
memory: 3956kb
input:
989 1 2 1 0 1 1 1 1 2 0 1 1 1 1 0 1 2 1 2 1 2 1 2 1 1 1 0 2 1 0 1 0 1 1 0 2 2 0 1 1 1 2 1 1 2 1 0 1 1 1 2 1 0 1 1 0 1 1 2 2 1 1 1 2 0 0 1 0 2 0 2 1 2 1 0 2 2 0 0 0 1 2 1 2 1 1 2 2 0 2 1 1 1 0 0 1 2 0 0 1 2 1 0 1 1 0 2 1 1 2 0 1 1 1 0 0 1 1 0 1 0 2 0 0 2 1 2 0 1 2 1 2 1 1 1 1 1 0 0 1 0 1 2 1 1 0 2 1 ...
output:
0 847 847 847 847 847 847 847 847 847 847 847 847 847 847 847 847 847 847 847 847 847 847 847 847 847 847 847 847 847 847 847 847 847 847 847 847 847 847 847 847 847 847 847 847 847 847 847 847 847 847 847 847 847 847 847 847 847 847 847 847 847 847 847 847 847 847 847 847 847 847 847 847 847 847 84...
result:
ok Accepted
Test #32:
score: 0
Accepted
time: 291ms
memory: 3652kb
input:
990 1 1 2 0 2 1 1 0 1 0 1 2 2 1 2 1 0 1 1 0 0 0 1 1 1 2 1 2 1 0 1 0 1 1 1 1 0 1 2 1 2 1 2 2 0 1 2 1 0 0 1 0 1 0 1 1 0 0 1 2 1 2 1 0 0 1 2 2 0 1 1 1 1 0 2 0 1 0 1 1 1 1 1 2 1 0 1 2 2 1 1 1 2 0 0 0 0 1 1 2 1 1 1 1 1 1 2 1 1 2 2 1 0 1 0 0 1 1 1 1 1 2 0 0 2 0 1 1 1 1 1 1 1 1 0 2 1 1 2 2 2 2 2 0 1 0 1 0 ...
output:
0 433 433 433 433 433 433 433 433 433 433 433 433 433 433 433 433 433 433 433 433 433 433 433 433 433 433 433 433 433 433 433 433 433 433 433 433 433 433 433 433 433 433 433 433 433 433 433 433 433 433 433 433 433 433 433 433 433 433 433 433 433 433 433 433 433 433 433 433 433 433 433 433 433 433 43...
result:
ok Accepted
Test #33:
score: 0
Accepted
time: 297ms
memory: 3868kb
input:
991 1 2 0 2 1 0 1 2 0 1 0 1 1 2 2 0 1 0 0 2 1 2 1 2 1 0 1 1 1 0 1 1 1 1 2 1 1 1 1 2 1 1 1 1 1 1 2 1 2 2 1 1 2 0 1 1 1 1 1 2 1 1 2 1 0 1 2 1 0 1 2 1 1 0 2 2 2 1 0 1 1 0 1 1 1 0 1 2 2 2 0 0 0 1 0 1 1 1 1 1 2 1 0 0 2 1 0 2 0 1 0 1 1 1 0 0 2 0 1 0 2 1 1 1 1 1 1 2 2 2 0 1 1 0 1 0 1 1 1 1 0 1 1 1 1 2 1 1 ...
output:
0 253 253 253 253 253 253 253 253 253 253 253 253 253 253 253 253 253 253 253 253 253 253 253 253 253 253 253 253 253 253 253 253 253 253 253 253 253 253 253 253 253 253 253 253 253 253 253 253 253 253 253 253 253 253 253 253 253 253 253 253 253 253 253 253 253 253 253 253 253 253 253 253 253 253 25...
result:
ok Accepted
Test #34:
score: 0
Accepted
time: 293ms
memory: 3776kb
input:
992 1 0 2 1 2 1 1 0 2 1 0 1 0 1 1 2 1 0 0 2 2 0 1 1 1 0 1 1 1 1 0 1 2 1 2 2 0 1 2 0 2 0 2 1 1 1 1 1 1 0 1 2 2 1 2 0 2 1 2 0 1 1 1 2 0 1 1 2 0 1 2 1 1 2 1 1 1 0 1 2 2 1 0 0 2 1 2 2 1 1 0 1 1 1 1 2 0 0 2 1 2 0 1 1 1 1 2 1 1 2 1 1 1 1 0 1 1 1 2 0 0 0 1 1 2 0 2 0 2 0 1 1 1 0 2 1 2 1 2 2 0 1 2 0 1 1 1 0 ...
output:
0 485 485 485 485 485 485 485 485 485 485 485 485 485 485 485 485 485 485 485 485 485 485 485 485 485 485 485 485 485 485 485 485 485 485 485 485 485 485 485 485 485 485 485 485 485 485 485 485 485 485 485 485 485 485 485 485 485 485 485 485 485 485 485 485 485 485 485 485 485 485 485 485 485 485 48...
result:
ok Accepted
Test #35:
score: 0
Accepted
time: 286ms
memory: 3652kb
input:
993 1 2 0 1 0 2 1 2 0 2 1 0 1 1 0 1 2 2 2 1 1 1 1 1 0 1 1 2 0 2 1 2 2 0 2 2 1 1 0 1 1 2 1 2 0 0 1 1 2 1 1 1 0 2 1 1 0 0 1 1 1 2 1 0 0 2 2 2 1 1 2 0 0 2 1 1 1 1 1 2 1 1 1 1 2 1 1 0 2 1 1 0 2 1 0 1 1 1 0 1 1 2 1 1 0 0 1 1 2 1 1 2 1 0 2 0 2 2 1 2 2 1 1 1 1 2 2 1 1 2 1 0 1 0 1 0 2 1 1 1 0 0 2 2 0 0 2 0 ...
output:
0 272 272 272 272 272 272 272 272 272 272 272 272 272 272 272 272 272 272 272 272 272 272 272 272 272 272 272 272 272 272 272 272 272 272 272 272 272 272 272 272 272 272 272 272 272 272 272 272 272 272 272 272 272 272 272 272 272 272 272 272 272 272 272 272 272 272 272 272 272 272 272 272 272 272 27...
result:
ok Accepted
Test #36:
score: 0
Accepted
time: 287ms
memory: 3712kb
input:
994 2 1 1 0 0 0 0 1 1 2 1 1 0 1 1 0 0 1 1 1 1 1 0 2 1 1 1 1 2 2 2 1 1 1 1 2 1 1 0 2 2 1 0 1 1 0 0 2 0 1 1 0 1 1 2 1 2 0 1 2 1 1 1 2 2 2 1 1 1 1 1 0 1 1 0 1 1 2 0 1 0 0 0 1 1 1 0 1 1 1 1 1 2 1 1 0 2 0 1 0 2 1 1 2 1 2 0 1 2 2 0 1 1 2 2 1 1 1 0 2 1 2 0 0 2 2 1 1 1 1 1 1 1 1 1 0 2 0 1 2 0 2 1 0 1 1 1 1 ...
output:
0 619 619 619 619 619 619 619 619 619 619 619 619 619 619 619 619 619 619 619 619 619 619 619 619 619 619 619 619 619 619 619 619 619 619 619 619 619 619 619 619 619 619 619 619 619 619 619 619 619 619 619 619 619 619 619 619 619 619 619 619 619 619 619 619 619 619 619 619 619 619 619 619 619 619 61...
result:
ok Accepted
Test #37:
score: 0
Accepted
time: 307ms
memory: 3872kb
input:
995 2 1 2 1 2 1 1 2 0 0 0 2 1 2 2 1 2 1 1 1 2 1 1 1 0 1 0 0 1 1 1 1 1 0 1 1 1 1 1 2 0 0 0 0 1 2 0 2 0 1 0 1 1 1 2 2 0 0 0 0 1 0 2 1 2 1 0 2 1 1 2 2 0 0 1 0 0 1 0 1 1 1 2 1 1 1 2 1 1 1 0 1 1 1 1 1 2 0 2 0 0 1 1 1 2 0 1 0 1 2 0 2 2 1 0 2 1 1 1 1 1 1 1 1 1 0 0 1 0 1 1 0 0 2 1 1 2 1 0 0 1 1 0 1 1 2 2 1 ...
output:
0 545 545 545 545 545 545 545 545 545 545 545 545 545 545 545 545 545 545 545 545 545 545 545 545 545 545 545 545 545 545 545 545 545 545 545 545 545 545 545 545 545 545 545 545 545 545 545 545 545 545 545 545 545 545 545 545 545 545 545 545 545 545 545 545 545 545 545 545 545 545 545 545 545 545 54...
result:
ok Accepted
Test #38:
score: 0
Accepted
time: 298ms
memory: 3716kb
input:
996 2 1 1 0 1 0 1 1 1 2 1 2 1 1 1 1 2 0 1 1 1 0 2 2 1 0 0 2 1 1 1 1 2 1 1 1 0 0 0 1 2 1 1 1 0 2 1 1 1 2 0 2 0 2 2 2 1 2 2 0 1 0 1 1 1 1 2 0 0 1 2 1 1 0 1 1 1 2 1 1 2 1 2 1 0 2 0 0 2 0 1 2 2 2 1 2 1 1 1 1 1 0 2 0 2 2 0 1 0 1 2 0 2 1 1 2 1 1 2 0 1 1 1 2 2 1 1 1 1 1 2 1 0 1 1 1 1 1 0 1 1 1 0 2 0 1 2 0 ...
output:
0 357 357 357 357 357 357 357 357 357 357 357 357 357 357 357 357 357 357 357 357 357 357 357 357 357 357 357 357 357 357 357 357 357 357 357 357 357 357 357 357 357 357 357 357 357 357 357 357 357 357 357 357 357 357 357 357 357 357 357 357 357 357 357 357 357 357 357 357 357 357 357 357 357 357 35...
result:
ok Accepted
Test #39:
score: 0
Accepted
time: 324ms
memory: 3776kb
input:
997 2 1 1 1 0 1 0 1 1 1 2 2 1 1 1 1 1 1 0 1 1 1 2 1 1 2 1 2 1 0 2 1 1 2 0 1 0 1 0 0 1 1 1 0 1 1 1 1 0 1 2 0 1 2 2 0 2 1 2 1 1 1 1 1 2 2 2 1 0 2 2 0 0 2 1 0 2 1 0 2 1 0 1 0 1 0 0 0 1 0 2 2 2 0 0 1 1 0 1 0 2 1 1 1 1 1 0 1 1 1 0 1 2 2 1 2 0 0 2 0 2 0 2 0 1 1 1 0 1 0 2 2 1 1 1 2 1 0 0 2 2 0 1 0 1 1 1 2 ...
output:
0 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 4...
result:
ok Accepted
Test #40:
score: 0
Accepted
time: 280ms
memory: 3648kb
input:
998 1 0 1 1 2 2 0 1 2 1 1 0 1 1 1 0 1 2 0 1 1 1 0 0 0 1 1 0 1 1 1 1 0 1 1 1 2 1 2 1 1 1 1 2 2 1 0 1 0 2 2 1 1 1 1 2 1 1 1 1 2 1 1 1 0 2 2 0 1 0 0 1 0 2 1 1 2 2 0 1 2 1 1 2 0 1 1 1 1 2 2 1 1 2 1 1 0 1 1 1 0 1 0 2 1 1 2 1 2 0 0 2 1 0 2 1 1 1 1 0 2 0 1 2 1 1 2 1 0 1 1 2 2 2 2 1 1 1 1 1 0 0 1 2 1 1 0 2 ...
output:
0 844 844 844 844 844 844 844 844 844 844 844 844 844 844 844 844 844 844 844 844 844 844 844 844 844 844 844 844 844 844 844 844 844 844 844 844 844 844 844 844 844 844 844 844 844 844 844 844 844 844 844 844 844 844 844 844 844 844 844 844 844 844 844 844 844 844 844 844 844 844 844 844 844 844 84...
result:
ok Accepted
Test #41:
score: 0
Accepted
time: 294ms
memory: 3848kb
input:
999 0 2 1 1 0 0 0 1 1 1 2 1 2 2 1 2 0 0 2 2 0 0 2 2 1 1 1 2 2 2 0 0 1 0 1 1 1 1 2 1 0 1 1 1 1 2 1 1 2 1 0 1 0 1 1 1 2 2 1 1 2 1 2 1 2 1 2 2 1 1 1 1 1 1 0 1 1 1 1 2 1 2 0 2 2 0 1 2 1 0 2 2 2 0 1 2 1 2 2 1 1 2 2 0 0 1 2 1 0 2 1 1 1 2 1 2 2 0 1 1 0 2 1 1 1 2 2 0 1 0 1 2 0 0 1 1 1 1 1 2 0 0 0 2 1 2 1 1 ...
output:
0 821 821 821 821 821 821 821 821 821 821 821 821 821 821 821 821 821 821 821 821 821 821 821 821 821 821 821 821 821 821 821 821 821 821 821 821 821 821 821 821 821 821 821 821 821 821 821 821 821 821 821 821 821 821 821 821 821 821 821 821 821 821 821 821 821 821 821 821 821 821 821 821 821 821 82...
result:
ok Accepted
Extra Test:
score: 0
Extra Test Passed