QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#780703 | #5088. Two Choreographies | vwxyz | AC ✓ | 1376ms | 128248kb | Python3 | 20.9kb | 2024-11-25 12:36:18 | 2024-11-25 12:36:18 |
Judging History
answer
from collections import deque
class Path_Doubling:
def __init__(self,N,permutation,V=None,f=None,e=None):
self.N=N
self.permutation=permutation
self.V=V
self.f=f
self.e=e
def Build_Next(self,K=None):
if K==None:
K=self.N
K=max(K,1)
self.k=K.bit_length()
self.doubling_permutation=[[None]*self.N for k in range(self.k)]
for n in range(self.N):
self.doubling_permutation[0][n]=self.permutation[n]
if self.V!=None:
self.doubling=[[self.e]*self.N for k in range(self.k)]
for n in range(self.N):
self.doubling[0][n]=self.V[n]
for k in range(1,self.k):
for n in range(self.N):
if self.doubling_permutation[k-1][n]!=None:
self.doubling_permutation[k][n]=self.doubling_permutation[k-1][self.doubling_permutation[k-1][n]]
if self.f!=None:
self.doubling[k][n]=self.f(self.doubling[k-1][n],self.doubling[k-1][self.doubling_permutation[k-1][n]])
def Doubling_Permutation(self,x,K):
if K<0 or 1<<self.k<=K:
return None
for k in range(self.k):
if K>>k&1 and x!=None:
x=self.doubling_permutation[k][x]
return x
def Doubling(self,x,K,edge=False):
if K<0:
return self.e
retu=self.e
for k in range(self.k):
if K>>k&1:
if self.doubling_permutation[k][x]==None:
return None
retu=self.f(retu,self.doubling[k][x])
x=self.doubling_permutation[k][x]
if not edge:
retu=self.f(retu,self.V[x])
return x,retu
def Bisect_Permutation(self,x,is_ok):
if not is_ok(x):
return -1,None
K=0
for k in range(self.k-1,-1,-1):
if is_ok(self.doubling_permutation[k][x]):
K|=1<<k
x=self.doubling_permutation[k][x]
return K,x
def Bisect(self,x,is_ok,edge=False):
if edge:
if not is_ok(x,self.e):
return -1,None,None
v=self.e
K=0
for k in range(self.k-1,-1,-1):
xx=self.doubling_permutation[k][x]
vv=self.f(v,self.doubling[k][x])
if is_ok(xx,vv):
K|=1<<k
x,v=xx,vv
else:
if not is_ok(x,self.V[x]):
return -1,None,None
v=self.V[x]
K=0
for k in range(self.k-1,-1,-1):
xx=self.doubling_permutation[k][x]
vv=self.f(v,self.doubling[k][self.permutation[x]])
if is_ok(xx,vv):
K|=1<<k
x,v=xx,vv
return K,x,v
class Graph:
def __init__(self,V,edges=None,graph=None,directed=False,weighted=False,inf=float("inf")):
self.V=V
self.directed=directed
self.weighted=weighted
self.inf=inf
if graph!=None:
self.graph=graph
"""
self.edges=[]
for i in range(self.V):
if self.weighted:
for j,d in self.graph[i]:
if self.directed or not self.directed and i<=j:
self.edges.append((i,j,d))
else:
for j in self.graph[i]:
if self.directed or not self.directed and i<=j:
self.edges.append((i,j))
"""
else:
self.edges=edges
self.graph=[[] for i in range(self.V)]
if weighted:
for i,j,d in self.edges:
self.graph[i].append((j,d))
if not self.directed:
self.graph[j].append((i,d))
else:
for i,j in self.edges:
self.graph[i].append(j)
if not self.directed:
self.graph[j].append(i)
def SIV_DFS(self,s,bipartite_graph=False,cycle_detection=False,directed_acyclic=False,euler_tour=False,linked_components=False,lowlink=False,parents=False,postorder=False,preorder=False,subtree_size=False,topological_sort=False,unweighted_dist=False,weighted_dist=False):
seen=[False]*self.V
finished=[False]*self.V
if directed_acyclic or cycle_detection or topological_sort:
dag=True
if euler_tour:
et=[]
if linked_components:
lc=[]
if lowlink:
order=[None]*self.V
ll=[None]*self.V
idx=0
if parents or cycle_detection or lowlink or subtree_size:
ps=[None]*self.V
if postorder or topological_sort:
post=[]
if preorder:
pre=[]
if subtree_size:
ss=[1]*self.V
if unweighted_dist or bipartite_graph:
uwd=[self.inf]*self.V
uwd[s]=0
if weighted_dist:
wd=[self.inf]*self.V
wd[s]=0
stack=[(s,0)] if self.weighted else [s]
while stack:
if self.weighted:
x,d=stack.pop()
else:
x=stack.pop()
if not seen[x]:
seen[x]=True
stack.append((x,d) if self.weighted else x)
if euler_tour:
et.append(x)
if linked_components:
lc.append(x)
if lowlink:
order[x]=idx
ll[x]=idx
idx+=1
if preorder:
pre.append(x)
for y in self.graph[x]:
if self.weighted:
y,d=y
if not seen[y]:
stack.append((y,d) if self.weighted else y)
if parents or cycle_detection or lowlink or subtree_size:
ps[y]=x
if unweighted_dist or bipartite_graph:
uwd[y]=uwd[x]+1
if weighted_dist:
wd[y]=wd[x]+d
elif not finished[y]:
if (directed_acyclic or cycle_detection or topological_sort) and dag:
dag=False
if cycle_detection:
cd=(y,x)
elif not finished[x]:
finished[x]=True
if euler_tour:
et.append(~x)
if lowlink:
bl=True
for y in self.graph[x]:
if self.weighted:
y,d=y
if ps[x]==y and bl:
bl=False
continue
ll[x]=min(ll[x],order[y])
if x!=s:
ll[ps[x]]=min(ll[ps[x]],ll[x])
if postorder or topological_sort:
post.append(x)
if subtree_size:
for y in self.graph[x]:
if self.weighted:
y,d=y
if y==ps[x]:
continue
ss[x]+=ss[y]
if bipartite_graph:
bg=[[],[]]
for tpl in self.edges:
x,y=tpl[:2] if self.weighted else tpl
if uwd[x]==self.inf or uwd[y]==self.inf:
continue
if not uwd[x]%2^uwd[y]%2:
bg=False
break
else:
for x in range(self.V):
if uwd[x]==self.inf:
continue
bg[uwd[x]%2].append(x)
retu=()
if bipartite_graph:
retu+=(bg,)
if cycle_detection:
if dag:
cd=[]
else:
y,x=cd
cd=self.Route_Restoration(y,x,ps)
retu+=(cd,)
if directed_acyclic:
retu+=(dag,)
if euler_tour:
retu+=(et,)
if linked_components:
retu+=(lc,)
if lowlink:
retu=(ll,)
if parents:
retu+=(ps,)
if postorder:
retu+=(post,)
if preorder:
retu+=(pre,)
if subtree_size:
retu+=(ss,)
if topological_sort:
if dag:
tp_sort=post[::-1]
else:
tp_sort=[]
retu+=(tp_sort,)
if unweighted_dist:
retu+=(uwd,)
if weighted_dist:
retu+=(wd,)
if len(retu)==1:
retu=retu[0]
return retu
def SIV_BFS(self,s,bfs_tour=False,bipartite_graph=False,linked_components=False,parents=False,unweighted_dist=False,weighted_dist=False):
seen=[False]*self.V
seen[s]=True
if bfs_tour:
bt=[s]
if linked_components:
lc=[s]
if parents:
ps=[None]*self.V
if unweighted_dist or bipartite_graph:
uwd=[self.inf]*self.V
uwd[s]=0
if weighted_dist:
wd=[self.inf]*self.V
wd[s]=0
queue=deque([s])
while queue:
x=queue.popleft()
for y in self.graph[x]:
if self.weighted:
y,d=y
if not seen[y]:
seen[y]=True
queue.append(y)
if bfs_tour:
bt.append(y)
if linked_components:
lc.append(y)
if parents:
ps[y]=x
if unweighted_dist or bipartite_graph:
uwd[y]=uwd[x]+1
if weighted_dist:
wd[y]=wd[x]+d
if bipartite_graph:
bg=[[],[]]
for tpl in self.edges:
i,j=tpl[:2] if self.weighted else tpl
if uwd[i]==self.inf or uwd[j]==self.inf:
continue
if not uwd[i]%2^uwd[j]%2:
bg=False
break
else:
for x in range(self.V):
if uwd[x]==self.inf:
continue
bg[uwd[x]%2].append(x)
retu=()
if bfs_tour:
retu+=(bt,)
if bipartite_graph:
retu+=(bg,)
if linked_components:
retu+=(lc,)
if parents:
retu+=(ps,)
if unweighted_dist:
retu+=(uwd,)
if weighted_dist:
retu+=(wd,)
if len(retu)==1:
retu=retu[0]
return retu
def MIV_DFS(self,initial_vertices=None,bipartite_graph=False,cycle_detection=False,directed_acyclic=False,euler_tour=False,linked_components=False,lowlink=False,parents=False,postorder=False,preorder=False,subtree_size=False,topological_sort=False,unweighted_dist=False,weighted_dist=False):
if initial_vertices==None:
initial_vertices=[s for s in range(self.V)]
seen=[False]*self.V
finished=[False]*self.V
if bipartite_graph:
bg=[None]*self.V
cnt=-1
if directed_acyclic or cycle_detection or topological_sort:
dag=True
if euler_tour:
et=[]
if linked_components:
lc=[]
if lowlink:
order=[None]*self.V
ll=[None]*self.V
idx=0
if parents or cycle_detection or lowlink or subtree_size:
ps=[None]*self.V
if postorder or topological_sort:
post=[]
if preorder:
pre=[]
if subtree_size:
ss=[1]*self.V
if bipartite_graph or unweighted_dist:
uwd=[self.inf]*self.V
if weighted_dist:
wd=[self.inf]*self.V
for s in initial_vertices:
if seen[s]:
continue
if bipartite_graph:
cnt+=1
bg[s]=(cnt,0)
if linked_components:
lc.append([])
if bipartite_graph or unweighted_dist:
uwd[s]=0
if weighted_dist:
wd[s]=0
stack=[(s,0)] if self.weighted else [s]
while stack:
if self.weighted:
x,d=stack.pop()
else:
x=stack.pop()
if not seen[x]:
seen[x]=True
stack.append((x,d) if self.weighted else x)
if euler_tour:
et.append(x)
if linked_components:
lc[-1].append(x)
if lowlink:
order[x]=idx
ll[x]=idx
idx+=1
if preorder:
pre.append(x)
for y in self.graph[x]:
if self.weighted:
y,d=y
if not seen[y]:
stack.append((y,d) if self.weighted else y)
if bipartite_graph:
bg[y]=(cnt,bg[x][1]^1)
if parents or cycle_detection or lowlink or subtree_size:
ps[y]=x
if unweighted_dist or bipartite_graph:
uwd[y]=uwd[x]+1
if weighted_dist:
wd[y]=wd[x]+d
elif not finished[y]:
if (directed_acyclic or cycle_detection or topological_sort) and dag:
dag=False
if cycle_detection:
cd=(y,x)
elif not finished[x]:
finished[x]=True
if euler_tour:
et.append(~x)
if lowlink:
bl=True
for y in self.graph[x]:
if self.weighted:
y,d=y
if ps[x]==y and bl:
bl=False
continue
ll[x]=min(ll[x],order[y])
if x!=s:
ll[ps[x]]=min(ll[ps[x]],ll[x])
if postorder or topological_sort:
post.append(x)
if subtree_size:
for y in self.graph[x]:
if self.weighted:
y,d=y
if y==ps[x]:
continue
ss[x]+=ss[y]
if bipartite_graph:
bg_=bg
bg=[[[],[]] for i in range(cnt+1)]
for tpl in self.edges:
i,j=tpl[:2] if self.weighted else tpl
if not bg_[i][1]^bg_[j][1]:
bg[bg_[i][0]]=False
for x in range(self.V):
if bg[bg_[x][0]]:
bg[bg_[x][0]][bg_[x][1]].append(x)
retu=()
if bipartite_graph:
retu+=(bg,)
if cycle_detection:
if dag:
cd=[]
else:
y,x=cd
cd=self.Route_Restoration(y,x,ps)
retu+=(cd,)
if directed_acyclic:
retu+=(dag,)
if euler_tour:
retu+=(et,)
if linked_components:
retu+=(lc,)
if lowlink:
retu=(ll,)
if parents:
retu+=(ps,)
if postorder:
retu+=(post,)
if preorder:
retu+=(pre,)
if subtree_size:
retu+=(ss,)
if topological_sort:
if dag:
tp_sort=post[::-1]
else:
tp_sort=[]
retu+=(tp_sort,)
if unweighted_dist:
retu+=(uwd,)
if weighted_dist:
retu+=(wd,)
if len(retu)==1:
retu=retu[0]
return retu
def Build_LCA(self,s,segment_tree=False):
self.lca_segment_tree=segment_tree
if self.lca_segment_tree:
self.lca_euler_tour,self.lca_parents,depth=self.SIV_DFS(s,euler_tour=True,parents=True,unweighted_dist=True)
self.lca_dfs_in_index=[None]*self.V
self.lca_dfs_out_index=[None]*self.V
for i,x in enumerate(self.lca_euler_tour):
if x>=0:
self.lca_dfs_in_index[x]=i
else:
self.lca_dfs_out_index[~x]=i
self.ST=Segment_Tree(2*self.V,min,self.V)
lst=[None]*(2*self.V)
for i in range(2*self.V-1):
if self.lca_euler_tour[i]>=0:
lst[i]=depth[self.lca_euler_tour[i]]
else:
lst[i]=depth[self.lca_parents[~self.lca_euler_tour[i]]]
lst[2*self.V-1]=-1
self.ST.Build(lst)
else:
self.lca_parents,self.lca_depth=self.SIV_DFS(s,parents=True,unweighted_dist=True)
self.lca_PD=Path_Doubling(self.V,self.lca_parents)
self.lca_PD.Build_Next(self.V)
def LCA(self,a,b):
if self.lca_segment_tree:
m=min(self.lca_dfs_in_index[a],self.lca_dfs_in_index[b])
M=max(self.lca_dfs_in_index[a],self.lca_dfs_in_index[b])
x=self.lca_euler_tour[self.ST.Fold_Index(m,M+1)]
if x>=0:
lca=x
else:
lca=self.lca_parents[~x]
else:
if self.lca_depth[a]>self.lca_depth[b]:
a,b=b,a
b=self.lca_PD.Doubling_Permutation(b,self.lca_depth[b]-self.lca_depth[a])
if a!=b:
for k in range(self.lca_PD.k-1,-1,-1):
if self.lca_PD.doubling_permutation[k][a]!=self.lca_PD.doubling_permutation[k][b]:
a,b=self.lca_PD.doubling_permutation[k][a],self.lca_PD.doubling_permutation[k][b]
a,b=self.lca_PD.doubling_permutation[0][a],self.lca_PD.doubling_permutation[0][b]
lca=a
return lca
def LCD(self):
lcd_points=self.MIV_DFS(linked_components=True)
lcd_edges=[[] for i in range(len(lcd_points))]
idx=[None]*self.V
for i in range(len(lcd_points)):
for j in range(len(lcd_points[i])):
idx[lcd_points[i][j]]=(i,j)
for tpl in self.edges:
if self.weighted:
x,y,d=tpl
else:
x,y=tpl
i,j0=idx[x]
i,j1=idx[y]
if self.weighted:
lcd_edges[i].append((j0,j1,d))
else:
lcd_edges[i].append((j0,j1))
return lcd_points,lcd_edges
N=int(input())
edges=[]
for i in range(2*N-3):
a,b=map(int,input().split())
a-=1;b-=1
edges.append((a,b))
G=Graph(N,edges=edges)
for P,E in zip(*G.LCD()):
le=len(P)
if le>3 and 2*le-3<=len(E):
GG=Graph(le,edges=E)
for x in range(le):
if len(GG.graph[x])>=3:
s=x
break
parents=GG.SIV_BFS(s,parents=True)
tree=[]
for x in range(le):
if parents[x]!=None:
tree.append((parents[x],x))
ST=Graph(le,edges=tree)
ST.Build_LCA(s)
parents,depth=ST.lca_parents,ST.lca_depth
D=[[] for d in range(le)]
for a,b in E:
if parents[a]!=b and parents[b]!=a:
lca=ST.LCA(a,b)
d=depth[a]+depth[b]-2*depth[lca]
D[d].append((a,b,lca))
for d in range(le):
if len(D[d])>=2:
def cycle(a,b,lca):
cycle0=[]
while a!=lca:
cycle0.append(a)
a=parents[a]
cycle1=[]
while b!=lca:
cycle1.append(b)
b=parents[b]
return cycle0+[lca]+cycle1[::-1]
A=cycle(*D[d].pop())
B=cycle(*D[d].pop())
print(d+1)
print(*[P[a]+1 for a in A])
print(*[P[b]+1 for b in B])
exit()
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 9ms
memory: 10712kb
input:
4 1 2 1 3 1 4 2 3 2 4
output:
3 2 1 4 2 1 3
result:
ok
Test #2:
score: 0
Accepted
time: 15ms
memory: 10808kb
input:
5 1 2 1 3 1 4 1 5 2 3 2 5 3 4
output:
3 3 1 4 2 1 5
result:
ok
Test #3:
score: 0
Accepted
time: 15ms
memory: 10688kb
input:
7 1 2 3 4 5 6 5 2 3 1 6 1 4 2 4 5 2 6 3 6 1 5
output:
3 3 1 6 2 1 6
result:
ok
Test #4:
score: 0
Accepted
time: 15ms
memory: 10816kb
input:
40 1 16 1 40 2 4 2 16 2 36 3 25 3 38 4 1 4 13 5 11 5 27 6 4 7 5 7 11 8 10 8 14 8 24 9 34 10 20 12 35 13 2 14 10 14 20 15 18 15 28 15 31 16 6 16 13 17 5 17 11 17 27 18 9 19 1 19 4 19 16 20 24 21 12 21 33 21 35 22 38 23 12 23 21 25 28 25 31 25 34 25 38 26 14 26 20 27 7 27 11 28 3 28 31 29 16 29 19 30 ...
output:
3 40 1 16 36 1 16
result:
ok
Test #5:
score: 0
Accepted
time: 4ms
memory: 10720kb
input:
201 1 7 1 114 1 119 2 49 2 93 4 197 5 139 6 1 6 27 7 39 7 121 8 127 9 130 9 145 11 106 11 136 11 193 12 2 12 116 13 55 13 69 13 105 13 187 13 196 14 144 14 177 15 127 15 134 15 145 15 155 15 184 15 199 16 96 16 177 17 20 21 100 22 68 22 71 22 81 22 142 23 148 23 190 24 12 24 81 24 89 25 158 25 159 2...
output:
3 192 154 40 154 61 96
result:
ok
Test #6:
score: 0
Accepted
time: 42ms
memory: 16072kb
input:
8000 2 1508 2 3068 3 5268 3 5501 6 266 6 2737 6 3197 6 5863 6 6697 7 3492 9 427 9 794 9 3114 9 5509 10 2257 10 4348 11 1479 11 1957 11 2230 11 2500 11 3182 11 4399 11 5051 11 7727 12 7669 13 1403 13 5753 14 2871 14 6956 14 7959 15 6902 17 1630 17 3155 17 5950 18 7232 19 125 19 3280 19 5648 20 6879 2...
output:
3 6030 478 393 6028 5394 871
result:
ok
Test #7:
score: 0
Accepted
time: 608ms
memory: 79272kb
input:
99999 1 11261 1 21544 2 9017 2 63063 2 97990 3 11995 3 42473 4 19846 5 38099 6 35872 6 80509 7 73231 8 12356 9 35384 10 45091 12 86727 13 4938 13 48917 14 62383 14 89846 15 28458 15 44277 15 51725 15 84522 16 93258 17 13934 17 42238 18 19000 19 11278 19 23672 19 61502 19 78791 20 85057 20 88080 21 2...
output:
3 67758 58209 60118 44552 99772 16314
result:
ok
Test #8:
score: 0
Accepted
time: 592ms
memory: 79192kb
input:
100000 1 68531 2 97359 4 68578 4 83098 4 98443 5 8053 5 30270 5 86617 6 7074 6 12266 6 69396 7 52675 7 78316 7 90757 7 92242 8 32677 8 41353 8 41457 8 74508 9 44234 10 4973 10 38390 10 96049 11 28007 11 68620 13 3016 14 36748 15 8147 15 25110 15 28489 15 72947 15 99347 16 70760 17 12774 17 68407 17 ...
output:
3 94081 9050 23292 90178 18420 97255
result:
ok
Test #9:
score: 0
Accepted
time: 11ms
memory: 10708kb
input:
7 1 2 2 3 3 4 4 5 5 6 6 7 7 5 1 4 7 3 1 6 7 1
output:
4 7 1 2 3 7 1 4 5
result:
ok
Test #10:
score: 0
Accepted
time: 930ms
memory: 126244kb
input:
100000 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 11 11 12 12 13 13 14 14 15 15 16 16 17 17 18 18 19 19 20 20 21 21 22 22 23 23 24 24 25 25 26 26 27 27 28 28 29 29 30 30 31 31 32 32 33 33 34 34 35 35 36 36 37 37 38 38 39 39 40 40 41 41 42 42 43 43 44 44 45 45 46 46 47 47 48 48 49 49 50 50 51 51 52 52 5...
output:
3 100000 1 7 100000 1 9
result:
ok
Test #11:
score: 0
Accepted
time: 0ms
memory: 10712kb
input:
8 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 6 1 4 8 4 8 3 8 2 1 8
output:
3 8 1 2 8 1 4
result:
ok
Test #12:
score: 0
Accepted
time: 15ms
memory: 10752kb
input:
9 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 1 3 1 4 9 5 9 4 1 7 9 2 1 9
output:
3 9 1 2 9 1 4
result:
ok
Test #13:
score: 0
Accepted
time: 15ms
memory: 10680kb
input:
10 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 8 1 4 10 6 1 6 10 4 10 3 1 9 10 1
output:
3 10 1 4 10 1 6
result:
ok
Test #14:
score: 0
Accepted
time: 15ms
memory: 11768kb
input:
1000 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 11 11 12 12 13 13 14 14 15 15 16 16 17 17 18 18 19 19 20 20 21 21 22 22 23 23 24 24 25 25 26 26 27 27 28 28 29 29 30 30 31 31 32 32 33 33 34 34 35 35 36 36 37 37 38 38 39 39 40 40 41 41 42 42 43 43 44 44 45 45 46 46 47 47 48 48 49 49 50 50 51 51 52 52 53 ...
output:
3 1000 1 3 1000 1 5
result:
ok
Test #15:
score: 0
Accepted
time: 95ms
memory: 21928kb
input:
9999 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 11 11 12 12 13 13 14 14 15 15 16 16 17 17 18 18 19 19 20 20 21 21 22 22 23 23 24 24 25 25 26 26 27 27 28 28 29 29 30 30 31 31 32 32 33 33 34 34 35 35 36 36 37 37 38 38 39 39 40 40 41 41 42 42 43 43 44 44 45 45 46 46 47 47 48 48 49 49 50 50 51 51 52 52 53 ...
output:
3 9999 1 5 9999 1 13
result:
ok
Test #16:
score: 0
Accepted
time: 90ms
memory: 21828kb
input:
10000 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 11 11 12 12 13 13 14 14 15 15 16 16 17 17 18 18 19 19 20 20 21 21 22 22 23 23 24 24 25 25 26 26 27 27 28 28 29 29 30 30 31 31 32 32 33 33 34 34 35 35 36 36 37 37 38 38 39 39 40 40 41 41 42 42 43 43 44 44 45 45 46 46 47 47 48 48 49 49 50 50 51 51 52 52 53...
output:
3 10000 1 4 10000 1 7
result:
ok
Test #17:
score: 0
Accepted
time: 853ms
memory: 120592kb
input:
94753 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 11 11 12 12 13 13 14 14 15 15 16 16 17 17 18 18 19 19 20 20 21 21 22 22 23 23 24 24 25 25 26 26 27 27 28 28 29 29 30 30 31 31 32 32 33 33 34 34 35 35 36 36 37 37 38 38 39 39 40 40 41 41 42 42 43 43 44 44 45 45 46 46 47 47 48 48 49 49 50 50 51 51 52 52 53...
output:
3 94753 1 3 94753 1 5
result:
ok
Test #18:
score: 0
Accepted
time: 932ms
memory: 126288kb
input:
99999 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 11 11 12 12 13 13 14 14 15 15 16 16 17 17 18 18 19 19 20 20 21 21 22 22 23 23 24 24 25 25 26 26 27 27 28 28 29 29 30 30 31 31 32 32 33 33 34 34 35 35 36 36 37 37 38 38 39 39 40 40 41 41 42 42 43 43 44 44 45 45 46 46 47 47 48 48 49 49 50 50 51 51 52 52 53...
output:
3 99999 1 2 99999 1 14
result:
ok
Test #19:
score: 0
Accepted
time: 11ms
memory: 10676kb
input:
7 1 2 2 3 3 4 4 5 5 6 6 7 1 3 1 4 1 5 1 6 1 7
output:
3 6 1 7 5 1 6
result:
ok
Test #20:
score: 0
Accepted
time: 850ms
memory: 125060kb
input:
100000 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 11 11 12 12 13 13 14 14 15 15 16 16 17 17 18 18 19 19 20 20 21 21 22 22 23 23 24 24 25 25 26 26 27 27 28 28 29 29 30 30 31 31 32 32 33 33 34 34 35 35 36 36 37 37 38 38 39 39 40 40 41 41 42 42 43 43 44 44 45 45 46 46 47 47 48 48 49 49 50 50 51 51 52 52 5...
output:
3 99999 1 100000 99998 1 99999
result:
ok
Test #21:
score: 0
Accepted
time: 15ms
memory: 10728kb
input:
8 1 2 2 3 3 4 4 5 5 6 6 7 7 8 1 3 1 4 1 5 1 6 1 7 1 8
output:
3 7 1 8 6 1 7
result:
ok
Test #22:
score: 0
Accepted
time: 5ms
memory: 10756kb
input:
9 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 1 3 1 4 1 5 1 6 1 7 1 8 1 9
output:
3 8 1 9 7 1 8
result:
ok
Test #23:
score: 0
Accepted
time: 15ms
memory: 10812kb
input:
10 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 1 3 1 4 1 5 1 6 1 7 1 8 1 9 1 10
output:
3 9 1 10 8 1 9
result:
ok
Test #24:
score: 0
Accepted
time: 12ms
memory: 11720kb
input:
1000 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 11 11 12 12 13 13 14 14 15 15 16 16 17 17 18 18 19 19 20 20 21 21 22 22 23 23 24 24 25 25 26 26 27 27 28 28 29 29 30 30 31 31 32 32 33 33 34 34 35 35 36 36 37 37 38 38 39 39 40 40 41 41 42 42 43 43 44 44 45 45 46 46 47 47 48 48 49 49 50 50 51 51 52 52 53 ...
output:
3 999 1 1000 998 1 999
result:
ok
Test #25:
score: 0
Accepted
time: 83ms
memory: 21728kb
input:
9999 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 11 11 12 12 13 13 14 14 15 15 16 16 17 17 18 18 19 19 20 20 21 21 22 22 23 23 24 24 25 25 26 26 27 27 28 28 29 29 30 30 31 31 32 32 33 33 34 34 35 35 36 36 37 37 38 38 39 39 40 40 41 41 42 42 43 43 44 44 45 45 46 46 47 47 48 48 49 49 50 50 51 51 52 52 53 ...
output:
3 9998 1 9999 9997 1 9998
result:
ok
Test #26:
score: 0
Accepted
time: 85ms
memory: 21692kb
input:
10000 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 11 11 12 12 13 13 14 14 15 15 16 16 17 17 18 18 19 19 20 20 21 21 22 22 23 23 24 24 25 25 26 26 27 27 28 28 29 29 30 30 31 31 32 32 33 33 34 34 35 35 36 36 37 37 38 38 39 39 40 40 41 41 42 42 43 43 44 44 45 45 46 46 47 47 48 48 49 49 50 50 51 51 52 52 53...
output:
3 9999 1 10000 9998 1 9999
result:
ok
Test #27:
score: 0
Accepted
time: 863ms
memory: 121836kb
input:
97065 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 11 11 12 12 13 13 14 14 15 15 16 16 17 17 18 18 19 19 20 20 21 21 22 22 23 23 24 24 25 25 26 26 27 27 28 28 29 29 30 30 31 31 32 32 33 33 34 34 35 35 36 36 37 37 38 38 39 39 40 40 41 41 42 42 43 43 44 44 45 45 46 46 47 47 48 48 49 49 50 50 51 51 52 52 53...
output:
3 97064 1 97065 97063 1 97064
result:
ok
Test #28:
score: 0
Accepted
time: 860ms
memory: 125168kb
input:
99999 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 11 11 12 12 13 13 14 14 15 15 16 16 17 17 18 18 19 19 20 20 21 21 22 22 23 23 24 24 25 25 26 26 27 27 28 28 29 29 30 30 31 31 32 32 33 33 34 34 35 35 36 36 37 37 38 38 39 39 40 40 41 41 42 42 43 43 44 44 45 45 46 46 47 47 48 48 49 49 50 50 51 51 52 52 53...
output:
3 99998 1 99999 99997 1 99998
result:
ok
Test #29:
score: 0
Accepted
time: 6ms
memory: 10716kb
input:
7 1 2 2 3 3 4 4 5 5 6 6 7 7 5 7 4 7 3 7 2 7 1
output:
3 5 7 6 4 7 5
result:
ok
Test #30:
score: 0
Accepted
time: 880ms
memory: 128236kb
input:
100000 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 11 11 12 12 13 13 14 14 15 15 16 16 17 17 18 18 19 19 20 20 21 21 22 22 23 23 24 24 25 25 26 26 27 27 28 28 29 29 30 30 31 31 32 32 33 33 34 34 35 35 36 36 37 37 38 38 39 39 40 40 41 41 42 42 43 43 44 44 45 45 46 46 47 47 48 48 49 49 50 50 51 51 52 52 5...
output:
3 99998 100000 99999 99997 100000 99998
result:
ok
Test #31:
score: 0
Accepted
time: 15ms
memory: 10836kb
input:
8 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 6 8 5 8 4 8 3 8 2 8 1
output:
3 6 8 7 5 8 6
result:
ok
Test #32:
score: 0
Accepted
time: 0ms
memory: 10752kb
input:
9 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 7 9 6 9 5 9 4 9 3 9 2 9 1
output:
3 7 9 8 6 9 7
result:
ok
Test #33:
score: 0
Accepted
time: 3ms
memory: 10820kb
input:
10 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 8 10 7 10 6 10 5 10 4 10 3 10 2 10 1
output:
3 8 10 9 7 10 8
result:
ok
Test #34:
score: 0
Accepted
time: 22ms
memory: 11756kb
input:
1000 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 11 11 12 12 13 13 14 14 15 15 16 16 17 17 18 18 19 19 20 20 21 21 22 22 23 23 24 24 25 25 26 26 27 27 28 28 29 29 30 30 31 31 32 32 33 33 34 34 35 35 36 36 37 37 38 38 39 39 40 40 41 41 42 42 43 43 44 44 45 45 46 46 47 47 48 48 49 49 50 50 51 51 52 52 53 ...
output:
3 998 1000 999 997 1000 998
result:
ok
Test #35:
score: 0
Accepted
time: 84ms
memory: 22060kb
input:
9999 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 11 11 12 12 13 13 14 14 15 15 16 16 17 17 18 18 19 19 20 20 21 21 22 22 23 23 24 24 25 25 26 26 27 27 28 28 29 29 30 30 31 31 32 32 33 33 34 34 35 35 36 36 37 37 38 38 39 39 40 40 41 41 42 42 43 43 44 44 45 45 46 46 47 47 48 48 49 49 50 50 51 51 52 52 53 ...
output:
3 9997 9999 9998 9996 9999 9997
result:
ok
Test #36:
score: 0
Accepted
time: 79ms
memory: 22120kb
input:
10000 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 11 11 12 12 13 13 14 14 15 15 16 16 17 17 18 18 19 19 20 20 21 21 22 22 23 23 24 24 25 25 26 26 27 27 28 28 29 29 30 30 31 31 32 32 33 33 34 34 35 35 36 36 37 37 38 38 39 39 40 40 41 41 42 42 43 43 44 44 45 45 46 46 47 47 48 48 49 49 50 50 51 51 52 52 53...
output:
3 9998 10000 9999 9997 10000 9998
result:
ok
Test #37:
score: 0
Accepted
time: 827ms
memory: 120612kb
input:
92892 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 11 11 12 12 13 13 14 14 15 15 16 16 17 17 18 18 19 19 20 20 21 21 22 22 23 23 24 24 25 25 26 26 27 27 28 28 29 29 30 30 31 31 32 32 33 33 34 34 35 35 36 36 37 37 38 38 39 39 40 40 41 41 42 42 43 43 44 44 45 45 46 46 47 47 48 48 49 49 50 50 51 51 52 52 53...
output:
3 92890 92892 92891 92889 92892 92890
result:
ok
Test #38:
score: 0
Accepted
time: 851ms
memory: 128248kb
input:
99999 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 11 11 12 12 13 13 14 14 15 15 16 16 17 17 18 18 19 19 20 20 21 21 22 22 23 23 24 24 25 25 26 26 27 27 28 28 29 29 30 30 31 31 32 32 33 33 34 34 35 35 36 36 37 37 38 38 39 39 40 40 41 41 42 42 43 43 44 44 45 45 46 46 47 47 48 48 49 49 50 50 51 51 52 52 53...
output:
3 99997 99999 99998 99996 99999 99997
result:
ok
Test #39:
score: 0
Accepted
time: 8ms
memory: 10720kb
input:
8 5 6 7 3 2 3 7 8 1 5 2 8 8 5 4 5 8 1 7 6 3 4 2 6 2 1
output:
3 8 1 5 2 1 8
result:
ok
Test #40:
score: 0
Accepted
time: 14ms
memory: 10716kb
input:
10 6 7 1 7 2 5 2 4 5 4 10 4 3 2 6 5 10 5 2 8 4 1 1 2 8 9 7 8 3 10 9 10 4 3
output:
3 3 4 10 10 4 5
result:
ok
Test #41:
score: 0
Accepted
time: 16ms
memory: 11800kb
input:
1000 272 271 393 394 369 404 981 980 169 185 362 361 387 386 482 481 383 382 370 788 266 106 938 223 876 877 107 106 109 110 481 480 633 14 886 885 588 589 673 567 568 693 531 932 562 561 871 872 89 959 951 950 119 556 484 891 981 271 75 74 443 444 865 730 374 15 580 233 716 165 882 829 622 623 606 ...
output:
4 843 296 295 842 471 470 469 472
result:
ok
Test #42:
score: 0
Accepted
time: 100ms
memory: 22056kb
input:
9999 1503 1502 1862 3917 4579 4578 9929 8919 4989 4990 4479 7716 5512 5511 4389 4390 4430 910 5616 3889 5708 5879 8848 8849 5400 5076 7827 3718 1169 1168 1574 213 3196 4013 2414 2415 2857 2858 9177 9178 7189 7190 3550 3549 7446 5351 7766 8059 2132 2646 8813 7870 2521 2522 5158 5157 4623 4624 4957 49...
output:
3 3722 9091 3723 8180 4342 8179
result:
ok
Test #43:
score: 0
Accepted
time: 97ms
memory: 22060kb
input:
10000 5462 4989 4542 4541 7300 8478 4730 3574 7930 7051 750 7627 117 3045 4274 4275 3840 3841 5706 3638 7108 7107 28 29 2564 2563 2784 2393 1193 1192 2040 1286 3688 3687 8048 2319 2404 2405 8641 8640 6992 8729 5085 5086 5130 5131 6813 9806 6592 6769 2806 2805 7482 6021 7371 3994 4939 3217 1905 6540 ...
output:
4 232 233 6196 900 4690 4689 4692 4691
result:
ok
Test #44:
score: 0
Accepted
time: 1326ms
memory: 127872kb
input:
99999 49253 51314 3093 3092 88617 72981 43336 77222 65739 55450 5166 90677 57235 57234 51512 51511 73274 86124 86611 77777 21808 21809 2794 2795 64109 69571 80102 80101 56177 27689 55899 58255 16908 16909 53732 53733 9213 9214 33157 33158 10706 10707 76016 11308 51459 74662 58149 58150 80976 56845 2...
output:
3 88087 50465 88086 24450 55489 55490
result:
ok
Test #45:
score: 0
Accepted
time: 1272ms
memory: 123908kb
input:
96827 15894 15895 33528 48199 50450 50451 63703 63702 49937 31980 93823 45726 96052 96051 54334 16426 9193 11656 49315 10079 10614 33488 84027 84028 3612 5321 64903 64904 56901 32611 33578 68521 47938 47939 32618 53239 89613 89612 82729 82728 34512 34511 54064 38673 56419 56420 23775 75336 85989 172...
output:
3 33469 387 33468 79880 89458 79881
result:
ok
Test #46:
score: 0
Accepted
time: 1319ms
memory: 127728kb
input:
100000 72105 72104 4352 4351 59159 59160 78993 64103 39235 39234 4458 36615 23543 53027 54635 54634 80821 80822 8720 72158 49535 78364 64357 3035 93490 6597 52195 13285 70186 70187 14748 98067 15516 71738 77617 77616 68836 68835 61569 61570 28477 28289 50823 50822 71759 49859 59464 59463 83701 83702...
output:
3 88632 79792 88633 45167 45168 19479
result:
ok
Test #47:
score: 0
Accepted
time: 1371ms
memory: 127748kb
input:
100000 53877 17887 7877 7878 35510 37710 15520 83926 7572 7573 11839 11840 75139 75140 63678 63679 66199 66198 3262 3263 78203 78204 87574 87575 53474 67658 86593 86594 28943 17005 71369 264 3802 41402 30583 30584 38511 38510 36776 90902 57208 57209 15408 48313 73488 46167 88419 93118 57411 57412 42...
output:
3 43732 43734 43733 11423 86970 34325
result:
ok
Test #48:
score: 0
Accepted
time: 1349ms
memory: 127656kb
input:
100000 78895 34726 20392 44705 57147 22069 31133 31132 78946 78947 53758 53757 68970 68971 75904 87094 12439 12438 92849 92848 80817 80818 76732 53635 79930 79931 78362 78363 87661 87662 47807 47808 73696 27386 30646 30645 17648 81813 47120 47119 84905 84906 87235 8058 8238 88843 86537 12191 68784 6...
output:
3 60958 60959 32264 58517 20300 20301
result:
ok
Test #49:
score: 0
Accepted
time: 1253ms
memory: 120792kb
input:
94055 34740 73546 30256 30255 20298 20299 62592 62591 49467 49468 65041 2277 38788 38787 58735 65469 2375 2376 77665 77666 36242 80298 75550 16701 13820 64701 83448 83449 79313 83990 2213 2212 22172 22171 72441 92184 10391 30730 39194 38883 25064 90160 69140 85068 50433 31078 58353 4381 38997 38998 ...
output:
3 69369 69368 69370 56377 60208 83040
result:
ok
Test #50:
score: 0
Accepted
time: 7ms
memory: 10720kb
input:
7 6 2 4 3 3 7 7 6 1 2 7 2 1 5 6 5 4 5 5 7 2 3
output:
4 7 5 1 2 3 4 5 7
result:
ok
Test #51:
score: 0
Accepted
time: 1376ms
memory: 126584kb
input:
99084 7128 52592 26282 84361 19470 70586 2431 2430 33596 72767 70001 70000 65483 65484 76493 76492 62792 39465 4476 31233 72512 72511 94244 69778 84662 84663 32214 32213 4717 4718 73918 26226 71389 71390 45765 45764 87589 87590 6207 6206 47094 70119 30908 29826 34602 40286 44413 44412 21890 21889 24...
output:
4 95948 33732 95950 95949 39497 39496 91152 39498
result:
ok
Test #52:
score: 0
Accepted
time: 15ms
memory: 10744kb
input:
8 6 5 3 4 2 3 3 7 2 4 6 7 4 8 5 2 2 1 1 6 7 8 5 4 8 1
output:
3 5 2 4 3 2 4
result:
ok
Test #53:
score: 0
Accepted
time: 15ms
memory: 10628kb
input:
9 6 7 7 3 9 8 4 3 2 1 6 2 6 8 5 6 7 8 1 4 9 4 4 5 9 6 1 9 2 3
output:
4 9 1 2 6 4 1 2 3
result:
ok
Test #54:
score: 0
Accepted
time: 15ms
memory: 10752kb
input:
9 5 4 1 5 3 2 1 2 2 9 6 7 1 8 3 4 7 5 5 6 5 9 6 3 9 1 7 8 8 9
output:
3 8 1 9 5 1 9
result:
ok
Test #55:
score: 0
Accepted
time: 9ms
memory: 10808kb
input:
10 1 8 10 9 4 9 6 4 2 1 2 3 7 2 4 5 10 3 5 8 2 9 6 5 8 9 4 8 6 7 7 8 3 4
output:
4 7 2 1 8 8 1 2 9
result:
ok
Test #56:
score: 0
Accepted
time: 12ms
memory: 10824kb
input:
9 5 6 8 7 1 2 5 2 8 6 6 9 9 8 2 9 4 7 4 1 4 5 6 1 2 3 3 4 7 6
output:
4 7 4 1 6 3 2 1 4
result:
ok
Test #57:
score: 0
Accepted
time: 7ms
memory: 10808kb
input:
10 1 2 3 2 6 8 5 4 5 6 8 7 4 1 6 7 4 3 2 5 3 10 8 9 6 2 10 1 9 3 8 4 9 10
output:
4 3 2 1 10 4 1 2 3
result:
ok
Test #58:
score: 0
Accepted
time: 9ms
memory: 10740kb
input:
9 3 6 2 1 5 6 9 7 4 2 4 3 1 3 8 9 1 5 6 7 4 6 1 9 7 8 4 5 2 3
output:
3 2 1 3 7 9 8
result:
ok
Test #59:
score: 0
Accepted
time: 11ms
memory: 10724kb
input:
4 1 2 4 1 4 3 3 1 4 2
output:
3 4 1 2 4 1 3
result:
ok
Test #60:
score: 0
Accepted
time: 14ms
memory: 10744kb
input:
10 8 10 10 9 7 8 8 3 6 3 1 3 9 6 1 8 5 10 3 4 10 4 3 9 2 1 1 9 6 5 6 10 9 5
output:
3 3 1 9 8 1 3
result:
ok
Test #61:
score: 0
Accepted
time: 15ms
memory: 11876kb
input:
1000 937 387 833 217 405 422 502 356 529 374 497 662 803 845 726 979 999 43 463 620 749 828 661 573 191 708 513 963 737 819 439 571 787 166 873 842 993 566 590 908 34 184 699 314 756 255 996 242 653 402 451 656 90 762 562 382 945 397 600 816 789 890 378 965 613 827 319 645 156 684 477 570 131 419 43...
output:
3 895 737 131 131 737 130
result:
ok
Test #62:
score: 0
Accepted
time: 101ms
memory: 22104kb
input:
9999 2524 8191 1533 7530 356 1008 8210 3560 2071 540 2876 4324 9158 3771 2872 5625 4701 4769 4728 2104 2264 9841 4009 2392 9900 4852 9836 1027 3996 1557 97 1319 5587 7722 7488 4073 2940 9762 246 6394 380 6935 7929 3557 8049 8841 2105 7255 2710 6626 7926 6255 8392 6949 6174 2040 9959 8955 8701 3730 5...
output:
3 2099 9300 5678 6414 3507 6293
result:
ok
Test #63:
score: 0
Accepted
time: 118ms
memory: 22032kb
input:
10000 8697 615 9680 5350 5924 4698 4478 7356 3510 7535 6046 3305 885 4890 8224 2297 2267 8411 7331 7035 1747 7766 3540 1409 4143 212 9541 5746 1062 539 2060 9566 5293 350 6143 2220 1446 2866 4603 4151 9625 5078 3432 4169 1528 1525 9522 2738 3154 3100 8560 9024 1200 4420 3138 9200 2346 182 1694 6303 ...
output:
3 6522 2861 7643 2715 5060 2123
result:
ok
Test #64:
score: 0
Accepted
time: 1344ms
memory: 127712kb
input:
99999 84520 53880 95569 33800 30674 78149 34453 98159 29766 87018 38710 45543 78103 64279 95388 6083 90709 6245 28076 59536 89121 25989 17455 86681 24869 49677 88947 54071 59069 14675 2211 80543 84618 24731 71749 96646 3072 81888 41124 19659 78748 83891 86353 92485 51719 3101 86489 39980 2846 67916 ...
output:
4 3784 47358 65690 96821 35954 81117 82006 93576
result:
ok
Test #65:
score: 0
Accepted
time: 1218ms
memory: 118148kb
input:
91648 4472 25803 85060 29770 38233 78885 69505 11992 74584 56733 44447 19721 38611 47816 64374 1051 85078 88959 3376 77926 30914 66149 47776 2665 24048 19740 63674 58321 31035 27289 28597 78620 26732 63968 3921 28544 88344 48945 17800 78918 39469 31300 58279 76356 88378 67190 87900 74995 96 31664 86...
output:
3 62864 37666 20120 37377 62933 38700
result:
ok
Test #66:
score: 0
Accepted
time: 1309ms
memory: 127736kb
input:
100000 13352 1027 26975 28733 58784 97055 76806 68544 9735 23022 13365 25281 80851 10373 95287 91860 59771 31042 51912 68412 26741 29961 34375 25709 13755 46111 50736 39736 95695 18184 57397 62912 97590 59408 6754 50322 16563 80551 76371 58366 31788 49867 41825 95414 16211 24996 32999 62870 4946 820...
output:
3 4054 65991 6709 17031 20743 28918
result:
ok
Test #67:
score: 0
Accepted
time: 1360ms
memory: 127652kb
input:
100000 20959 25336 91898 62660 72720 51175 61002 85224 24094 15898 17841 75902 96298 91723 60352 50707 73566 69660 14089 5220 50982 29437 79898 86395 1734 56103 52555 46603 63369 73948 72151 60200 25210 3152 38452 28051 85173 32730 57691 99457 69691 30053 2072 97708 97968 56344 65532 44367 12342 346...
output:
3 51313 90358 61536 52465 5035 63185
result:
ok
Test #68:
score: 0
Accepted
time: 1366ms
memory: 127616kb
input:
100000 16435 98228 89180 57831 43189 90862 16293 29922 91964 47722 34278 901 54950 37026 95302 76757 42452 74646 38280 38053 65541 27258 36041 61691 27600 40344 23817 62272 71323 52794 81547 61348 39381 11415 52865 23221 79787 93823 91146 34985 66479 79975 16439 79659 36874 49350 50891 86175 33479 5...
output:
3 65174 40404 57991 94685 55137 57324
result:
ok
Test #69:
score: 0
Accepted
time: 1289ms
memory: 122908kb
input:
95728 48566 69797 54999 85490 75942 40279 51954 81016 58241 2418 39067 29211 81791 12312 77375 65571 56275 38417 19545 83406 22125 73565 35590 62148 23344 55309 39501 86411 68603 19541 75927 74829 9467 14763 65439 91977 45467 52791 94490 35940 32928 3568 76229 95312 78704 76042 23090 10023 59356 602...
output:
3 28487 63021 93427 8713 66613 69132
result:
ok
Test #70:
score: 0
Accepted
time: 12ms
memory: 10740kb
input:
5 2 4 2 3 5 3 5 1 1 3 4 5 1 2
output:
3 5 1 3 2 1 3
result:
ok
Test #71:
score: 0
Accepted
time: 1304ms
memory: 119744kb
input:
93309 71437 20546 7225 87604 42872 46689 48394 70601 79628 80229 46286 21730 85596 24788 78402 13849 4309 88242 46678 82455 59146 64364 43993 73409 35381 77031 24159 45740 49493 15690 53789 31467 78790 88954 13595 76316 85033 35716 5254 44215 33086 43366 81849 23644 22197 53918 78118 73130 44242 230...
output:
3 65524 31812 74190 52969 81982 84886
result:
ok
Test #72:
score: 0
Accepted
time: 5ms
memory: 10740kb
input:
6 5 3 1 3 5 2 5 1 3 6 6 4 1 2 5 6 3 2
output:
3 3 1 2 5 1 2
result:
ok
Test #73:
score: 0
Accepted
time: 15ms
memory: 10680kb
input:
7 6 3 5 4 7 1 1 6 3 1 7 3 2 7 7 4 3 5 2 5 7 5
output:
3 2 7 5 7 1 3
result:
ok
Test #74:
score: 0
Accepted
time: 14ms
memory: 10716kb
input:
8 5 1 7 6 7 3 7 5 1 8 3 2 6 5 1 4 6 1 7 8 6 3 7 4 8 6
output:
3 8 1 6 6 1 5
result:
ok
Test #75:
score: 0
Accepted
time: 14ms
memory: 10736kb
input:
9 1 3 4 8 2 4 8 6 5 4 8 5 9 2 9 4 8 9 1 6 2 3 5 2 4 7 7 1 9 5
output:
5 2 3 1 7 4 4 7 1 6 8
result:
ok
Test #76:
score: 0
Accepted
time: 8ms
memory: 10676kb
input:
10 6 5 8 3 8 9 9 10 3 4 10 6 7 8 6 9 2 3 4 7 6 8 4 10 6 3 6 4 5 10 5 4 9 5
output:
3 5 4 10 6 3 4
result:
ok
Test #77:
score: 0
Accepted
time: 8ms
memory: 10764kb
input:
9 6 5 5 8 7 8 2 3 7 2 3 6 5 2 9 1 6 4 5 3 5 7 4 2 4 7 3 1 9 7
output:
3 4 2 7 5 3 2
result:
ok
Test #78:
score: 0
Accepted
time: 7ms
memory: 10748kb
input:
10 3 6 10 4 3 7 2 3 3 8 8 9 10 9 2 10 6 5 4 3 4 2 1 3 8 6 5 1 10 1 10 7 10 6
output:
3 8 3 6 4 3 2
result:
ok