QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#886003 | #10000. Add, Remove, Transform | Naganohara_Yoimiya | WA | 13ms | 5120kb | C++20 | 6.7kb | 2025-02-06 20:04:21 | 2025-02-06 20:04:22 |
Judging History
answer
#include<bits/stdc++.h>
#define ll long long
#define mk make_pair
#define fi first
#define se second
using namespace std;
#define gc getchar
inline int read(){
int x=0,f=1;char c=getchar();
for(;(c<'0'||c>'9');c=getchar()){if(c=='-')f=-1;}
for(;(c>='0'&&c<='9');c=getchar())x=x*10+(c&15);
return x*f;
}
template<typename T>void cmax(T &x,T v){x=max(x,v);}
template<typename T>void cmin(T &x,T v){x=min(x,v);}
vector<pair<int,int> >getTree(vector<int>P){ // prufer sequence -> tree
int n=P.size()+2;
vector<int>deg(n,1);for(int x:P)deg[x]++;
set<int>Leaf;vector<pair<int,int> >edges;
for(int i=0;i<n;i++)if(deg[i]==1)Leaf.insert(i);
for(int i=0;i<n-2;i++){
int x=*Leaf.begin();Leaf.erase(Leaf.begin());
int y=P[i];edges.emplace_back(mk(y,x));
if(--deg[y]==1)Leaf.insert(y);
}
edges.emplace_back(mk(*Leaf.begin(),*--Leaf.end()));
return edges;
}
void A(int x,int y,vector<vector<int> >&G){G[x][y]^=1,G[y][x]^=1;}
void oper(int a,int b,int c,int d,vector<vector<int> >&G){
assert(G[a][b]&&G[b][c]&&G[c][d]&&a!=b&&a!=c&&a!=d&&b!=c&&b!=d&&c!=d);
A(a,b,G),A(b,c,G),A(c,d,G),A(c,a,G),A(a,d,G),A(d,b,G);
}
const int N=1305; // 6^4 = 1296
map<vector<vector<int> >,int>ID;
vector<vector<int> >Gs[N];
int pre[N];
struct OP{int a,b,c,d;OP(int A=0,int B=0,int C=0,int D=0):a(A),b(B),c(C),d(D){}};
OP rec[N];
vector<pair<int,OP> >to[N];
OP rev(OP x){return OP(x.c,x.a,x.d,x.b);}
void prework(){
int n=6,ncnt=0;
vector<int>P(n-2);
for(P[0]=0;P[0]<n;P[0]++)for(P[1]=0;P[1]<n;P[1]++)for(P[2]=0;P[2]<n;P[2]++)for(P[3]=0;P[3]<n;P[3]++){
auto E=getTree(P);++ncnt;
vector<vector<int> >G(n,vector<int>(n));
for(auto [u,v]:E)G[u][v]=G[v][u]=1;
ID[G]=ncnt,Gs[ncnt]=G;
}
// assert(ncnt==1296);
for(int i=1;i<=ncnt;i++){
auto G=Gs[i];
for(int a=0;a<n;a++)for(int b=0;b<n;b++)for(int c=0;c<n;c++)for(int d=0;d<n;d++){
if(a==b||a==c||a==d||b==c||b==d||c==d)continue;
if(!G[a][b]||!G[b][c]||!G[c][d])continue;
oper(a,b,c,d,G);
to[i].emplace_back(mk(ID[G],OP(a,b,c,d)));
oper(c,a,d,b,G);
}
}
queue<int>Q;Q.push(2);
while(Q.size()){
int x=Q.front();Q.pop();
for(auto [y,op]:to[x])if(!pre[y])pre[y]=x,rec[y]=op,Q.push(y);
}
}
vector<OP>find_path(vector<vector<int> >G1,vector<vector<int> >G2){
int n=G1.size();
// cerr<<" G1 = ";for(int i=0;i<n;i++)for(int j=i+1;j<n;j++)if(G1[i][j])cerr<<"("<<i<<","<<j<<") ";cerr<<endl;
// cerr<<" G2 = ";for(int i=0;i<n;i++)for(int j=i+1;j<n;j++)if(G2[i][j])cerr<<"("<<i<<","<<j<<") ";cerr<<endl;
int x=ID[G1],y=ID[G2];
// cerr<<"x,y = "<<x<<" "<<y<<" pre = "<<pre[x]<<" "<<pre[y]<<endl;
assert(pre[x]&&pre[y]);
vector<OP>path,path2;
while(y!=2)path2.emplace_back(rec[y]),y=pre[y];
reverse(path2.begin(),path2.end());
while(x!=2)path.emplace_back(rev(rec[x])),x=pre[x];
for(auto op:path2)path.emplace_back(op);
return path;
}
vector<OP>ans;
void add_op(int a,int b,int c,int d){ans.emplace_back(OP(a,b,c,d));}
void solve(){
int n=read(),k=3;
vector<vector<int> >G(n,vector<int>(n)),adj(n);
for(int i=1;i<=n-1;i++){
int u=read()-1,v=read()-1;
G[u][v]=G[v][u]=1,adj[u].emplace_back(v),adj[v].emplace_back(u);
}
auto bfs=[&](int u){
queue<int>q;vector<int>dis(n,-1);
dis[u]=0;q.push(u);
while(q.size()){
int x=q.front();q.pop();
for(int y=0;y<n;y++)if(G[x][y]&&dis[y]==-1)dis[y]=dis[x]+1,q.push(y);
}
return dis;
};
auto diam=[&](){
auto dis=bfs(0);int x=0;
for(int i=0;i<n;i++)if(dis[i]>dis[x])x=i;
dis=bfs(x);
for(int i=0;i<n;i++)if(dis[i]>dis[x])x=i;
return dis[x];
};
if(diam()<=2)return puts("0"),void();
if(k==2)return puts("-1"),void();
if(n==5){
if(diam()==4){
auto dis=bfs(0);int x=0;
for(int i=0;i<n;i++)if(dis[i]>dis[x])x=i;
dis=bfs(x);vector<int>id(10);
for(int i=0;i<n;i++)id[dis[i]]=i;
puts("1");
cout<<id[0]<<" "<<id[1]<<" "<<id[2]<<" "<<id[3]<<endl;
}
else puts("0");
return ;
}
auto compact=[&](vector<int>nodes){
assert(nodes.size()==6&&nodes[0]==0);
// cerr<<"compact : nodes = ";for(int x:nodes)cerr<<x<<" ";cerr<<endl;
vector<int>id(n);
for(int i=0;i<6;i++)id[nodes[i]]=i;
vector<vector<int> >G1(6,vector<int>(6)),G2(6,vector<int>(6));
for(int i=0;i<6;i++)for(int j=0;j<6;j++)G1[i][j]=G[nodes[i]][nodes[j]];
G2[0][1]=G2[0][2]=G2[0][3]=G2[0][4]=G2[4][5]=1;
G2[1][0]=G2[2][0]=G2[3][0]=G2[4][0]=G2[5][4]=1;
auto ops=find_path(G1,G2);
for(auto op:ops){
auto [a,b,c,d]=op;
a=nodes[a],b=nodes[b],c=nodes[c],d=nodes[d];
oper(a,b,c,d,G),add_op(a,b,c,d);
}
};
// cerr<<"now G = ";for(int i=0;i<n;i++)for(int j=i+1;j<n;j++)if(G[i][j])cout<<"("<<i<<","<<j<<") ";puts("");
// cerr<<"now diam = "<<diam()<<endl;
while(true){
vector<int>fa(n),dep(n),d(n),hson(n,-1);
function<void(int)>dfs=[&](int u){
hson[u]=-1;
for(int v=0;v<n;v++)if(G[u][v]&&fa[u]!=v){
fa[v]=u,dep[v]=dep[u]+1,dfs(v);
cmax(d[u],d[v]+1);if(hson[u]==-1||d[v]>d[hson[u]])hson[u]=v;
}
};
dfs(0);bool hav=false;
for(int i=0;i<n;i++)if(dep[i]>=3)hav=true;
// cerr<<"dep = ";for(int i=0;i<n;i++)cerr<<dep[i]<<" \n"[i==n-1];
if(!hav)break;
vector<int>nodes;
function<void(int)>dfs2=[&](int u){
if(nodes.size()==6)return ;
nodes.emplace_back(u);
if(hson[u]!=-1)dfs2(hson[u]);
for(int v=0;v<n;v++)if(G[u][v]&&v!=fa[u]&&v!=hson[u])dfs2(v);
};
dfs2(0);
compact(nodes);
// cerr<<" -> G = ";for(int i=0;i<n;i++)for(int j=i+1;j<n;j++)if(G[i][j])cout<<"("<<i<<","<<j<<") ";puts("");
}
auto output=[&](){
cout<<ans.size()<<'\n';
for(auto [a,b,c,d]:ans)cout<<a+1<<" "<<b+1<<" "<<c+1<<" "<<d+1<<'\n';
vector<OP>().swap(ans);
return ;
};
if(diam()<=3)return output();
assert(diam()==4);
// cerr<<"ok"<<endl;
while(diam()>=4){
vector<int>fa(n),dep(n);
function<void(int)>dfs=[&](int u){
for(int v=0;v<n;v++)if(v!=fa[u]&&G[u][v])fa[v]=u,dep[v]=dep[u]+1,dfs(v);
};
dfs(0);
int x=-1,y=-1;
for(int i=0;i<n;i++)if(dep[i]==2){
x=i;auto dis=bfs(x);
for(int j=0;j<n;j++)if(dis[j]==4){y=j;break;}
break;
}
assert(x!=-1&&y!=-1);
int p=-1;
for(int i=0;i<n;i++)if(i!=0&&i!=x&&i!=y&&i!=fa[x]&&i!=fa[y]){
if(G[0][i]||G[fa[x]][i]||G[fa[y]][i])p=i;
}
assert(p!=-1);
// cerr<<"x,y = "<<x<<" "<<y<<" fa = "<<fa[x]<<" "<<fa[y]<<" p = "<<p<<endl;
vector<int>nodes(6);
nodes[0]=0,nodes[1]=x,nodes[2]=fa[x],nodes[3]=p,nodes[4]=fa[y],nodes[5]=y;
compact(nodes);
// cerr<<" -> diam = "<<diam()<<endl;
}
assert(diam()<=3);
output();
}
signed main(void){
#ifndef ONLINE_JUDGE
freopen("in.txt","r",stdin);
freopen("out.out","w",stdout);
// freopen("2.in","r",stdin);
// freopen("2.out","w",stdout);
#endif
prework();
int tt=1;
// int tt=read();
while(tt--)solve();
return 0;
}
詳細信息
Test #1:
score: 100
Accepted
time: 8ms
memory: 4864kb
input:
6 1 2 2 3 3 4 4 5 5 6
output:
11 1 2 3 4 1 4 5 6 2 4 6 1 3 1 2 6 3 6 1 4 2 3 4 6 5 1 3 6 1 6 2 4 3 5 6 4 1 4 3 6 1 6 4 5
result:
ok ok nice tree :D
Test #2:
score: 0
Accepted
time: 13ms
memory: 4992kb
input:
100 4 44 45 44 33 44 60 44 71 44 25 44 69 44 57 44 16 44 78 44 17 44 10 44 21 44 80 44 2 44 98 44 20 44 83 44 3 44 79 44 22 44 65 44 5 44 39 44 23 44 100 44 66 44 7 44 14 44 81 44 6 44 41 44 59 44 87 44 32 44 63 44 74 44 84 44 86 44 18 44 24 44 96 4 35 44 8 44 62 44 58 44 85 44 53 44 82 44 42 44 12 ...
output:
1474 1 4 44 45 44 1 45 70 70 44 45 4 48 45 70 1 44 4 70 48 70 44 48 1 4 48 70 1 44 1 4 70 44 70 1 45 4 44 45 70 48 1 44 70 1 70 4 45 44 48 70 45 1 45 44 70 1 70 45 48 4 1 44 2 100 44 4 26 26 100 4 2 1 2 26 44 100 2 44 1 100 1 26 4 2 1 4 100 4 2 100 44 1 100 4 44 1 44 100 26 2 44 26 1 44 1 2 26 44 26...
result:
ok ok nice tree :D
Test #3:
score: 0
Accepted
time: 11ms
memory: 4992kb
input:
99 60 59 19 59 47 59 83 59 41 59 33 59 99 59 7 59 15 59 36 59 50 59 9 59 10 59 76 59 14 59 30 59 90 59 43 59 88 59 8 59 27 59 25 59 81 59 3 59 38 59 68 59 24 59 1 59 58 59 21 59 44 59 87 59 4 59 74 59 72 59 79 59 16 59 64 60 82 59 12 59 37 59 22 59 61 59 65 59 20 59 35 59 54 59 56 60 23 59 26 59 28 ...
output:
1425 1 59 19 77 2 59 77 1 19 1 2 77 59 1 77 19 77 59 19 71 1 19 77 71 2 19 71 1 59 71 2 1 19 1 59 2 19 2 1 71 59 19 71 2 77 1 19 2 1 2 59 71 19 77 2 71 1 71 19 2 1 2 71 77 1 59 60 56 56 1 60 29 49 60 56 29 29 49 56 59 49 59 29 60 1 29 49 60 1 60 29 56 59 60 56 1 60 1 59 56 60 56 1 29 59 60 29 56 49 ...
result:
ok ok nice tree :D
Test #4:
score: 0
Accepted
time: 12ms
memory: 4864kb
input:
99 59 57 45 57 93 57 5 57 80 57 77 57 70 57 14 57 64 57 39 57 81 57 18 57 7 57 11 57 73 57 67 57 8 57 29 59 66 57 63 57 4 57 74 57 83 57 21 57 52 59 28 57 27 57 26 57 36 57 38 57 32 59 53 59 24 57 49 57 58 45 94 57 89 57 65 59 12 57 46 59 54 57 60 57 51 57 50 57 15 59 19 59 40 93 35 45 6 57 99 59 96...
output:
1310 1 57 5 76 4 57 76 1 5 1 4 76 57 1 76 5 76 57 5 37 1 5 76 37 4 5 37 1 57 37 4 1 5 1 57 4 5 4 1 37 57 5 37 4 76 1 5 4 1 4 57 37 5 76 4 37 1 37 5 4 1 4 37 76 1 57 45 35 35 1 45 2 3 45 35 2 2 3 35 57 3 57 2 45 1 2 3 45 1 45 2 35 57 45 35 1 45 1 57 35 45 35 1 2 57 45 2 35 3 1 45 35 1 35 57 2 45 3 35...
result:
ok ok nice tree :D
Test #5:
score: 0
Accepted
time: 12ms
memory: 4864kb
input:
98 77 49 52 49 78 49 72 49 91 49 85 49 21 49 32 49 96 49 42 49 79 49 41 49 89 49 24 49 46 49 36 49 48 49 86 49 12 49 88 49 60 49 6 49 39 49 53 49 59 49 90 49 50 49 25 49 10 49 81 49 83 49 54 49 82 49 16 52 94 49 87 49 40 49 14 52 65 77 19 49 51 49 7 49 98 49 84 78 4 49 9 77 70 52 75 49 20 77 80 77 6...
output:
1315 1 49 52 18 18 1 52 14 16 52 18 14 14 16 18 49 16 49 14 52 1 14 16 52 1 52 14 18 49 52 18 1 52 1 49 18 52 18 1 14 49 52 14 18 16 1 52 18 1 18 49 14 52 16 18 14 1 14 52 18 1 18 14 16 1 49 72 76 76 1 72 28 45 72 76 28 28 45 76 49 45 49 28 72 1 28 45 72 1 72 28 76 49 72 76 1 72 1 49 76 72 76 1 28 4...
result:
ok ok nice tree :D
Test #6:
score: 0
Accepted
time: 9ms
memory: 4864kb
input:
100 26 54 89 54 35 54 99 54 24 54 18 54 66 54 59 54 49 54 52 54 70 54 73 54 1 26 4 54 69 54 20 26 2 54 50 26 79 54 94 54 78 89 5 54 74 54 44 54 75 54 98 54 96 54 90 54 17 54 38 26 58 26 80 89 30 26 15 26 48 26 16 26 82 35 63 54 33 26 39 89 22 89 65 54 67 54 60 89 3 54 97 89 7 70 40 26 19 26 56 54 88...
output:
1308 1 26 54 24 54 1 24 21 21 54 24 26 13 24 21 1 54 26 21 13 21 54 13 1 26 13 21 1 54 1 26 21 54 21 1 24 26 54 24 21 13 1 54 21 1 21 26 24 54 13 21 24 1 24 54 21 1 21 24 13 15 26 50 27 16 26 27 15 50 15 16 27 1 26 15 27 16 50 27 1 26 27 16 1 50 1 26 16 50 16 1 27 26 50 27 16 15 1 50 16 1 16 26 27 5...
result:
ok ok nice tree :D
Test #7:
score: 0
Accepted
time: 11ms
memory: 4864kb
input:
98 84 21 68 21 67 21 78 21 93 21 98 21 19 21 51 21 43 21 96 21 95 21 50 84 7 21 27 21 6 21 89 21 46 21 38 84 71 84 53 68 4 21 69 84 77 21 14 21 32 84 29 21 42 84 40 21 91 21 15 21 5 21 82 21 57 84 44 21 28 21 13 84 9 68 41 21 1 68 62 21 52 21 65 84 86 93 31 21 87 93 39 67 37 93 75 68 56 21 36 21 83 ...
output:
1257 1 68 21 19 21 1 19 23 23 21 19 68 11 19 23 1 21 68 23 11 23 21 11 1 68 11 23 1 21 1 68 23 21 23 1 19 68 21 19 23 11 1 21 23 1 23 68 19 21 11 23 19 1 19 21 23 1 23 19 11 3 21 51 8 4 21 8 3 51 3 4 8 1 21 3 8 4 51 8 1 21 8 4 1 51 1 21 4 51 4 1 8 21 51 8 4 3 1 51 4 1 4 21 8 51 3 4 8 1 8 51 4 1 4 8 ...
result:
ok ok nice tree :D
Test #8:
score: 0
Accepted
time: 11ms
memory: 4992kb
input:
99 94 74 1 74 89 74 80 74 87 74 79 74 61 74 23 74 96 94 24 74 25 74 97 74 86 94 82 74 5 74 76 74 41 89 9 94 43 74 50 89 17 89 12 74 72 74 3 74 8 74 58 74 18 23 62 74 60 74 39 89 15 87 55 74 10 89 27 80 44 74 42 94 11 94 48 1 98 23 63 89 37 89 54 80 4 1 91 74 93 74 29 94 59 74 78 94 32 79 38 80 52 94...
output:
1038 7 89 41 77 1 74 89 77 1 77 7 41 89 1 41 77 41 89 77 74 74 41 77 1 7 1 74 89 77 74 7 89 1 89 77 7 74 89 7 1 89 1 74 7 89 7 1 41 74 89 41 7 77 1 89 7 1 7 74 41 89 77 7 41 1 41 89 7 1 7 41 77 9 94 96 35 1 74 94 35 1 35 9 96 94 1 96 35 96 94 35 74 74 96 35 1 9 1 74 94 35 74 9 94 1 94 35 9 74 94 9 1...
result:
ok ok nice tree :D
Test #9:
score: 0
Accepted
time: 10ms
memory: 4992kb
input:
100 40 41 50 41 29 41 30 41 43 41 73 41 89 41 87 41 60 50 36 41 61 40 1 41 63 41 51 41 27 41 88 41 62 41 90 41 49 41 23 41 93 41 24 41 80 29 72 30 66 43 48 50 85 29 56 30 98 41 32 41 68 41 91 41 100 29 16 29 92 30 38 40 9 41 25 60 59 41 65 41 82 40 83 29 99 40 86 41 19 29 64 41 5 30 26 60 13 30 37 7...
output:
1099 1 41 50 60 50 1 60 25 25 50 60 41 17 60 25 1 50 41 25 17 25 50 17 1 41 17 25 1 50 1 41 25 50 25 1 60 41 50 60 25 17 1 50 25 1 25 41 60 50 17 25 60 1 60 50 25 1 25 60 17 1 41 27 53 9 41 53 1 27 1 9 53 41 1 53 27 53 41 27 42 1 27 53 42 9 27 42 1 41 42 9 1 27 1 41 9 27 9 1 42 41 27 42 9 53 1 27 9 ...
result:
ok ok nice tree :D
Test #10:
score: 0
Accepted
time: 10ms
memory: 4992kb
input:
99 29 35 14 35 80 35 61 35 19 35 48 14 65 35 67 35 18 29 39 29 56 35 49 14 93 29 64 29 95 35 16 61 77 35 53 35 24 35 31 35 75 35 60 61 79 39 46 29 74 35 86 80 13 61 42 65 22 35 8 80 85 35 94 19 91 14 96 39 37 35 63 65 69 56 73 35 72 61 17 80 21 48 52 19 10 14 20 29 92 67 27 31 4 14 41 29 89 14 25 14...
output:
1049 1 39 29 35 1 35 14 48 39 35 48 1 29 1 39 48 29 48 1 35 39 29 35 48 14 1 29 48 1 48 39 35 29 14 48 35 1 35 29 48 1 48 35 14 52 19 94 7 1 35 19 7 1 7 52 94 19 1 94 7 94 19 7 35 35 94 7 1 52 1 35 19 7 35 52 19 1 19 7 52 35 19 52 1 19 1 35 52 19 52 1 94 35 19 94 52 7 1 19 52 1 52 35 94 19 7 52 94 1...
result:
ok ok nice tree :D
Test #11:
score: 0
Accepted
time: 9ms
memory: 4864kb
input:
100 42 55 63 55 69 42 54 55 74 55 82 69 83 55 18 69 99 55 33 55 95 42 90 63 85 42 66 69 14 55 75 55 81 42 3 69 40 63 89 42 77 63 53 74 88 83 60 83 84 55 35 63 47 42 52 54 15 54 97 55 50 55 70 42 98 54 67 55 44 82 24 63 71 54 1 42 4 74 16 33 27 42 80 18 61 85 48 42 13 85 38 55 51 63 87 18 96 89 65 63...
output:
989 1 42 55 54 1 54 15 91 42 54 91 1 55 1 42 91 55 91 1 54 42 55 54 91 15 1 55 91 1 91 42 54 55 15 91 54 1 54 55 91 1 91 54 15 1 42 69 66 1 66 72 41 42 66 41 1 69 1 42 41 69 41 1 66 42 69 66 41 72 1 69 41 1 41 42 66 69 72 41 66 1 66 69 41 1 41 66 72 1 55 63 40 63 1 40 36 36 63 40 55 19 40 36 1 63 55...
result:
ok ok nice tree :D
Test #12:
score: 0
Accepted
time: 12ms
memory: 4864kb
input:
99 98 49 63 49 83 63 93 49 8 63 77 98 16 49 42 49 40 63 37 49 4 98 19 63 5 98 1 93 31 49 45 98 64 49 24 49 96 63 12 16 86 93 91 98 15 77 85 8 72 5 67 98 36 98 89 37 7 83 78 49 9 98 53 98 18 15 35 63 76 31 97 77 17 19 25 64 34 15 74 63 66 16 48 8 30 40 21 19 59 19 82 49 29 40 10 1 13 64 22 31 55 16 4...
output:
992 1 93 49 98 1 98 77 15 93 98 15 1 49 1 93 15 49 15 1 98 93 49 98 15 77 1 49 15 1 15 93 98 49 77 15 98 1 98 49 15 1 15 98 77 1 49 63 8 1 8 48 80 49 8 80 1 63 1 49 80 63 80 1 8 49 63 8 80 48 1 63 80 1 80 49 8 63 48 80 8 1 8 63 80 1 80 8 48 33 16 12 20 1 49 16 20 1 20 33 12 16 1 12 20 12 16 20 49 49...
result:
ok ok nice tree :D
Test #13:
score: 0
Accepted
time: 9ms
memory: 5120kb
input:
99 22 89 66 89 23 89 79 89 72 89 51 89 39 66 44 89 43 79 53 22 50 66 14 51 92 66 58 79 80 79 18 23 42 66 76 22 11 50 36 22 71 39 48 79 84 89 98 89 85 50 68 44 77 44 60 80 9 22 69 42 31 14 75 39 94 89 30 23 96 22 15 89 3 76 95 42 74 66 19 42 78 22 8 23 28 79 38 58 21 51 65 79 34 44 97 79 6 36 2 71 29...
output:
984 1 72 89 51 1 51 14 31 72 51 31 1 89 1 72 31 89 31 1 51 72 89 51 31 14 1 89 31 1 31 72 51 89 14 31 51 1 51 89 31 1 31 51 14 1 89 66 39 1 39 71 2 89 39 2 1 66 1 89 2 66 2 1 39 89 66 39 2 71 1 66 2 1 2 89 39 66 71 2 39 1 39 66 2 1 2 39 71 1 89 79 80 1 80 60 41 89 80 41 1 79 1 89 41 79 41 1 80 89 79...
result:
ok ok nice tree :D
Test #14:
score: 0
Accepted
time: 10ms
memory: 5120kb
input:
99 93 45 64 93 73 45 46 45 5 93 55 45 65 45 18 45 47 5 11 45 76 18 49 55 50 46 26 64 14 65 43 64 85 55 83 45 15 5 66 43 19 93 78 45 20 93 10 26 2 49 89 93 68 76 84 45 25 15 29 11 9 43 16 73 24 18 72 64 32 93 61 14 30 49 38 89 51 68 56 65 13 29 92 43 86 11 42 76 6 72 40 65 54 84 48 5 36 19 8 32 77 5 ...
output:
820 1 5 93 45 1 45 73 16 5 45 16 1 93 1 5 16 93 16 1 45 5 93 45 16 73 1 93 16 1 16 5 45 93 73 16 45 1 45 93 16 1 16 45 73 1 93 64 43 1 43 66 4 93 43 4 1 64 1 93 4 64 4 1 43 93 64 43 4 66 1 64 4 1 4 93 43 64 66 4 43 1 43 64 4 1 4 43 66 1 45 11 29 1 29 13 62 45 29 62 1 11 1 45 62 11 62 1 29 45 11 29 6...
result:
ok ok nice tree :D
Test #15:
score: 0
Accepted
time: 8ms
memory: 4992kb
input:
99 60 88 91 88 36 60 80 91 41 80 33 91 97 36 90 41 32 91 1 33 42 90 27 60 84 91 4 97 52 97 55 91 65 91 9 97 38 32 2 60 12 27 78 90 82 33 8 91 64 32 59 90 87 27 66 27 3 32 48 65 85 41 47 4 22 80 26 91 24 82 17 4 7 36 63 55 23 88 92 38 46 80 69 4 39 12 35 33 96 90 76 66 73 65 29 4 6 87 74 9 77 97 43 4...
output:
825 1 33 91 88 1 88 60 36 33 88 36 1 91 1 33 36 91 36 1 88 33 91 88 36 60 1 91 36 1 36 33 88 91 60 36 88 1 88 91 36 1 36 88 60 1 60 36 97 1 97 4 17 60 97 17 1 36 1 60 17 36 17 1 97 60 36 97 17 4 1 36 17 1 17 60 97 36 4 17 97 1 97 36 17 1 17 97 4 1 91 80 41 1 41 90 42 91 41 42 1 80 1 91 42 80 42 1 41...
result:
ok ok nice tree :D
Test #16:
score: 0
Accepted
time: 10ms
memory: 4864kb
input:
100 33 25 26 25 10 26 78 25 30 26 66 25 79 10 22 33 63 78 76 33 44 63 14 66 47 22 9 25 88 79 12 63 82 12 54 10 61 78 99 47 95 76 29 10 64 9 71 25 8 66 77 78 90 78 58 14 65 76 35 8 28 9 97 9 100 14 41 97 37 82 59 71 1 47 42 9 3 78 52 78 94 22 67 65 36 37 16 22 24 12 38 61 17 22 4 22 27 76 56 35 68 76...
output:
915 1 47 22 33 1 33 25 66 47 33 66 1 22 1 47 66 22 66 1 33 47 22 33 66 25 1 22 66 1 66 47 33 22 25 66 33 1 33 22 66 1 66 33 25 1 25 66 8 1 8 35 56 25 8 56 1 66 1 25 56 66 56 1 8 25 66 8 56 35 1 66 56 1 56 25 8 66 35 56 8 1 8 66 56 1 56 8 35 1 25 78 63 1 63 12 82 25 63 82 1 78 1 25 82 78 82 1 63 25 7...
result:
ok ok nice tree :D
Test #17:
score: 0
Accepted
time: 10ms
memory: 4992kb
input:
99 16 31 89 31 52 89 47 16 69 16 24 69 92 69 82 89 55 52 6 24 22 47 37 89 58 31 65 37 48 89 34 22 97 58 56 31 81 89 74 55 49 16 5 52 18 58 79 49 41 6 21 18 96 82 23 55 36 41 3 21 4 92 10 49 2 79 42 18 54 52 7 58 61 97 59 54 26 96 20 59 98 42 19 82 72 92 95 3 84 69 50 4 99 23 13 20 83 7 71 79 62 36 1...
output:
846 1 21 18 58 1 58 31 89 21 58 89 1 18 1 21 89 18 89 1 58 21 18 58 89 31 1 18 89 1 89 21 58 18 31 89 58 1 58 18 89 1 89 58 31 1 31 89 52 1 52 54 59 31 52 59 1 89 1 31 59 89 59 1 52 31 89 52 59 54 1 89 59 1 59 31 52 89 54 59 52 1 52 89 59 1 59 52 54 1 31 16 69 1 69 24 6 31 69 6 1 16 1 31 6 16 6 1 69...
result:
ok ok nice tree :D
Test #18:
score: 0
Accepted
time: 8ms
memory: 5120kb
input:
100 17 92 15 92 68 17 72 15 70 17 3 70 40 68 23 72 7 3 82 3 95 3 20 95 9 68 25 82 59 40 90 25 54 23 75 90 91 54 12 59 38 82 32 7 63 90 10 20 41 38 19 59 2 63 39 75 1 41 73 63 100 54 79 91 65 32 28 41 89 100 69 1 64 91 80 25 6 10 52 100 96 65 58 28 61 69 14 25 37 7 27 41 13 54 30 15 55 27 48 75 66 13...
output:
807 1 41 38 82 1 82 3 70 41 82 70 1 38 1 41 70 38 70 1 82 41 38 82 70 3 1 38 70 1 70 41 82 38 3 70 82 1 82 38 70 1 70 82 3 1 3 70 17 1 17 92 15 3 17 15 1 70 1 3 15 70 15 1 17 3 70 17 15 92 1 70 15 1 15 3 17 70 92 15 17 1 17 70 15 1 15 17 92 1 92 15 72 1 72 23 54 92 72 54 1 15 1 92 54 15 54 1 72 92 1...
result:
ok ok nice tree :D
Test #19:
score: 0
Accepted
time: 9ms
memory: 4992kb
input:
99 16 57 76 16 28 76 96 76 40 28 81 40 30 96 56 40 12 96 54 12 65 12 78 65 52 12 38 78 97 81 19 38 21 30 4 21 85 30 49 19 74 30 33 12 20 74 67 38 66 97 26 33 72 65 87 4 82 67 9 78 73 56 35 21 41 82 47 66 61 33 77 47 23 82 3 73 34 87 64 74 15 26 95 54 10 52 62 77 83 72 17 66 37 77 31 73 45 3 86 97 89...
output:
746 1 9 78 65 1 65 12 96 9 65 96 1 78 1 9 96 78 96 1 65 9 78 65 96 12 1 78 96 1 96 9 65 78 12 96 65 1 65 78 96 1 96 65 12 1 12 96 76 1 76 28 40 12 76 40 1 96 1 12 40 96 40 1 76 12 96 76 40 28 1 96 40 1 40 12 76 96 28 40 76 1 76 96 40 1 40 76 28 1 28 40 56 1 56 73 3 28 56 3 1 40 1 28 3 40 3 1 56 28 4...
result:
ok ok nice tree :D
Test #20:
score: 0
Accepted
time: 10ms
memory: 4992kb
input:
98 81 63 9 81 80 9 68 9 92 68 76 68 98 68 74 98 2 74 3 92 29 3 54 29 66 54 10 3 51 3 60 66 33 54 97 60 48 3 7 33 23 97 16 66 69 23 6 23 25 23 11 97 39 11 95 25 27 16 30 27 12 27 75 33 87 25 89 12 90 48 83 23 34 7 8 89 28 90 94 6 17 28 40 11 91 87 77 28 72 69 73 25 62 94 32 87 43 72 70 43 52 62 18 12...
output:
718 1 16 66 60 1 60 97 11 16 60 11 1 66 1 16 11 66 11 1 60 16 66 60 11 97 1 66 11 1 11 16 60 66 97 11 60 1 60 66 11 1 11 60 97 1 66 54 29 1 29 3 48 66 29 48 1 54 1 66 48 54 48 1 29 66 54 29 48 3 1 54 48 1 48 66 29 54 3 48 29 1 29 54 48 1 48 29 3 1 97 11 40 1 40 13 85 97 40 85 1 11 1 97 85 11 85 1 40...
result:
ok ok nice tree :D
Test #21:
score: 0
Accepted
time: 9ms
memory: 4864kb
input:
99 86 19 98 86 71 98 61 71 25 71 13 25 27 61 64 25 17 61 90 17 5 64 67 5 99 5 29 17 48 67 85 64 10 67 58 10 54 90 53 17 36 54 38 53 30 38 57 53 78 53 92 58 95 92 81 85 73 92 56 78 66 56 41 58 52 92 72 41 84 95 60 95 28 60 6 52 20 6 4 60 74 38 51 78 96 28 97 4 82 52 83 60 63 51 69 96 3 28 1 97 79 3 3...
output:
764 1 97 4 60 1 60 95 92 97 60 92 1 4 1 97 92 4 92 1 60 97 4 60 92 95 1 4 92 1 92 97 60 4 95 92 60 1 60 4 92 1 92 60 95 1 95 92 58 1 58 10 67 95 58 67 1 92 1 95 67 92 67 1 58 95 92 58 67 10 1 92 67 1 67 95 58 92 10 67 58 1 58 92 67 1 67 58 10 1 10 67 5 1 5 64 25 10 5 25 1 67 1 10 25 67 25 1 5 10 67 ...
result:
ok ok nice tree :D
Test #22:
score: 0
Accepted
time: 8ms
memory: 4992kb
input:
98 96 66 38 96 28 38 35 38 75 35 74 75 71 74 93 74 57 93 67 57 3 67 44 3 98 67 77 98 49 77 48 98 14 44 73 48 69 49 81 14 12 69 63 73 78 81 55 73 8 69 76 69 92 63 36 8 31 92 30 76 26 78 4 30 91 26 23 36 27 91 43 36 15 31 18 12 50 14 10 18 19 91 40 18 13 19 88 27 70 40 1 88 52 43 56 70 79 1 11 10 7 52...
output:
671 1 88 27 91 1 91 26 78 88 91 78 1 27 1 88 78 27 78 1 91 88 27 91 78 26 1 27 78 1 78 88 91 27 26 78 91 1 91 27 78 1 78 91 26 1 26 78 81 1 81 14 44 26 81 44 1 78 1 26 44 78 44 1 81 26 78 81 44 14 1 78 44 1 44 26 81 78 14 44 81 1 81 78 44 1 44 81 14 1 14 44 3 1 3 67 98 14 3 98 1 44 1 14 98 44 98 1 3...
result:
ok ok nice tree :D
Test #23:
score: 0
Accepted
time: 8ms
memory: 4864kb
input:
100 57 54 69 57 23 69 86 23 99 86 6 99 73 6 82 6 35 73 76 35 44 35 13 44 33 13 2 76 34 2 40 33 43 2 59 13 26 43 67 26 47 43 15 47 60 47 74 67 58 67 16 58 53 58 72 2 96 58 90 74 41 16 46 15 38 58 29 38 17 38 5 38 7 46 63 47 88 46 78 88 51 63 61 78 42 78 84 88 28 63 91 61 21 17 81 91 10 78 65 91 32 65...
output:
744 1 51 63 47 1 47 15 46 51 47 46 1 63 1 51 46 63 46 1 47 51 63 47 46 15 1 63 46 1 46 51 47 63 15 46 47 1 47 63 46 1 46 47 15 1 47 43 2 1 2 76 35 47 2 35 1 43 1 47 35 43 35 1 2 47 43 2 35 76 1 43 35 1 35 47 2 43 76 35 2 1 2 43 35 1 35 2 76 1 15 46 88 1 88 78 61 15 88 61 1 46 1 15 61 46 61 1 88 15 4...
result:
ok ok nice tree :D
Test #24:
score: 0
Accepted
time: 9ms
memory: 4864kb
input:
100 71 76 23 71 82 23 30 82 65 30 92 65 21 92 42 21 62 42 56 42 96 56 48 62 79 48 9 79 97 9 85 48 35 97 53 85 89 9 36 89 32 36 70 89 37 70 95 70 51 32 78 95 88 36 80 88 67 95 7 80 49 7 33 67 45 33 28 45 99 28 40 99 34 33 10 34 25 10 50 34 59 10 47 59 20 59 77 20 12 59 75 40 84 75 60 75 93 75 66 75 7...
output:
709 1 83 41 91 1 91 57 55 83 91 55 1 41 1 83 55 41 55 1 91 83 41 91 55 57 1 41 55 1 55 83 91 41 57 55 91 1 91 41 55 1 55 91 57 1 57 55 19 1 19 27 87 57 19 87 1 55 1 57 87 55 87 1 19 57 55 19 87 27 1 55 87 1 87 57 19 55 27 87 19 1 19 55 87 1 87 19 27 1 27 87 60 1 60 75 40 27 60 40 1 87 1 27 40 87 40 ...
result:
ok ok nice tree :D
Test #25:
score: 0
Accepted
time: 7ms
memory: 4864kb
input:
98 84 60 49 84 57 49 35 57 23 35 64 23 29 35 75 64 25 75 86 25 55 25 14 29 88 14 58 14 3 58 56 3 98 56 59 98 62 98 5 59 19 62 34 19 39 19 70 34 79 5 27 79 41 27 66 27 63 66 77 34 24 77 52 24 12 24 78 52 68 78 40 78 38 40 44 38 61 40 20 61 43 61 82 43 22 20 6 20 53 20 4 40 8 22 37 4 91 43 65 8 97 65 ...
output:
716 1 73 16 87 1 87 89 50 73 87 50 1 16 1 73 50 16 50 1 87 73 16 87 50 89 1 16 50 1 50 73 87 16 89 50 87 1 87 16 50 1 50 87 89 1 89 50 91 1 91 43 61 89 91 61 1 50 1 89 61 50 61 1 91 89 50 91 61 43 1 50 61 1 61 89 91 50 43 61 91 1 91 50 61 1 61 91 43 1 43 61 40 1 40 78 52 43 40 52 1 61 1 43 52 61 52 ...
result:
ok ok nice tree :D
Test #26:
score: 0
Accepted
time: 9ms
memory: 4992kb
input:
98 22 27 53 22 67 53 34 67 5 34 6 5 62 6 46 62 92 46 94 92 43 94 54 43 82 54 13 82 76 82 98 76 31 98 74 31 10 74 32 10 26 74 24 10 85 32 25 85 87 85 42 25 66 42 48 25 41 66 30 42 70 30 86 41 56 86 93 56 39 56 4 39 45 4 78 4 49 45 38 56 37 49 47 38 95 38 12 95 20 95 17 12 51 20 21 17 75 17 65 75 60 6...
output:
759 1 11 91 75 1 75 17 12 11 75 12 1 91 1 11 12 91 12 1 75 11 91 75 12 17 1 91 12 1 12 11 75 91 17 12 75 1 75 91 12 1 12 75 17 1 17 12 95 1 95 38 56 17 95 56 1 12 1 17 56 12 56 1 95 17 12 95 56 38 1 12 56 1 56 17 95 12 38 56 95 1 95 12 56 1 56 95 38 1 38 56 86 1 86 41 66 38 86 66 1 56 1 38 66 56 66 ...
result:
ok ok nice tree :D
Test #27:
score: -100
Wrong Answer
time: 8ms
memory: 4992kb
input:
5 4 5 5 1 1 2 2 3
output:
1 2 1 0 4
result:
wrong answer Integer parameter [name=v3] equals to 0, violates the range [1, 5]