QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#99013 | #3501. Jail | xiaoyaowudi | 66 | 2241ms | 580340kb | C++17 | 3.9kb | 2023-04-21 08:42:49 | 2023-04-21 08:42:52 |
Judging History
answer
#include <cstdio>
#include <algorithm>
#include <vector>
#include <cstring>
using namespace std;
constexpr int N=120010,M=30000010,MM=10000010;
int hd[M],nxt[M<<1],t[M<<1],cnt,ncnt,d[M],n,m;
void add_edge(int a,int b){/*printf("%d %d\n",a,b);*/nxt[++cnt]=hd[a],t[cnt]=b,hd[a]=cnt,++d[b];}
struct inT{
int cnt;struct _z{int c[2],id1,id2;}z[MM];
void init(){cnt=0;}void pu(int v){if(z[v].c[0]) add_edge(z[v].id1,z[z[v].c[0]].id1),add_edge(z[z[v].c[0]].id2,z[v].id2);
if(z[v].c[1]) add_edge(z[v].id1,z[z[v].c[1]].id1),add_edge(z[z[v].c[1]].id2,z[v].id2);}
int upd(int u,int cl,int cr,int pos,int val){
int v=++cnt;z[v]=z[u];z[v].id1=++ncnt,z[v].id2=++ncnt;
if(cl==cr){add_edge(z[v].id1,val);add_edge(val,z[v].id2);return v;}int mid=(cl+cr)>>1;
(pos<=mid)?(z[v].c[0]=upd(z[u].c[0],cl,mid,pos,val)):(z[v].c[1]=upd(z[u].c[1],mid+1,cr,pos,val));pu(v);
return v;
}
int del(int u,int cl,int cr,int pos){
if(cl==cr) return 0;int mid=(cl+cr)>>1;int ls=z[u].c[0],rs=z[u].c[1];
(pos<=mid)?ls=del(z[u].c[0],cl,mid,pos):rs=del(z[u].c[1],mid+1,cr,pos);if(!ls && !rs) return 0;
int v=++cnt;z[v].c[0]=ls,z[v].c[1]=rs,z[v].id1=++ncnt,z[v].id2=++ncnt;pu(v);return v;
}
int merge(int u,int v,int cl,int cr){
if(!u || !v) return u|v;if(cl==cr) return u;int mid=(cl+cr)>>1;z[u].id1=++ncnt,z[u].id2=++ncnt;
z[u].c[0]=merge(z[u].c[0],z[v].c[0],cl,mid);
z[u].c[1]=merge(z[u].c[1],z[v].c[1],mid+1,cr);pu(u);return u;
}
void qry1(int u,int cl,int cr,int ql,int qr,int val){
if(!u) return;if(cl>=ql && cr<=qr){add_edge(val,z[u].id1);return;}int mid=(cl+cr)>>1;
if(ql<=mid) qry1(z[u].c[0],cl,mid,ql,qr,val);if(qr>mid) qry1(z[u].c[1],mid+1,cr,ql,qr,val);
}
void qry2(int u,int cl,int cr,int ql,int qr,int val){
if(!u) return;if(cl>=ql && cr<=qr){add_edge(z[u].id2,val);return;}int mid=(cl+cr)>>1;
if(ql<=mid) qry2(z[u].c[0],cl,mid,ql,qr,val);if(qr>mid) qry2(z[u].c[1],mid+1,cr,ql,qr,val);
}
}T1;
#define pb emplace_back
int rts[N];int qq[M],ql,qr;bool vis[N];
int siz[N],son[N],top[N],ff[N],dep[N],st[N],ed[N];vector<int> dels[N],es[N];
int lca(int u,int v){while(top[u]!=top[v]){if(dep[top[u]]<dep[top[v]]) swap(u,v);u=ff[top[u]];}return dep[u]<dep[v]?u:v;}
void dfs(int u,int fa){siz[u]=1,son[u]=0,ff[u]=fa,dep[u]=dep[fa]+1;for(int v:es[u]) if(v!=fa) dfs(v,u),siz[u]+=siz[v],(siz[v]>siz[son[u]]?son[u]=v:0);}
void dfs(int u,int fa,int tp){top[u]=tp;if(son[u]) dfs(son[u],u,tp);for(int v:es[u]) if(v!=fa && v!=son[u]) dfs(v,u,v);}
void calc(int u,int fa){for(int v:es[u]) if(v!=fa) calc(v,u),rts[u]=T1.merge(rts[u],rts[v],1,m);
if(rts[u] && st[u]){
if(st[u]>1) T1.qry1(rts[u],1,m,1,st[u]-1,st[u]);
if(st[u]<m) T1.qry1(rts[u],1,m,st[u]+1,m,st[u]);
}
if(rts[u] && ed[u]){
if(ed[u]>1) T1.qry2(rts[u],1,m,1,ed[u]-1,ed[u]);
if(ed[u]<m) T1.qry2(rts[u],1,m,ed[u]+1,m,ed[u]);
}
for(int i:dels[u]) rts[u]=T1.del(rts[u],1,m,i);}
int main(){
int T;scanf("%d",&T);
while(T--){
scanf("%d",&n);
for(int i=1,u,v;i<n;++i) scanf("%d%d",&u,&v),es[u].pb(v),es[v].pb(u);
dfs(1,0);dfs(1,0,1);
scanf("%d",&m);ncnt=m;
for(int i=1,u,v;i<=m;++i){
scanf("%d%d",&u,&v);int k=lca(u,v);dels[k].pb(i);//printf("%d %d %d\n",u,v,k);
rts[u]=T1.upd(rts[u],1,m,i,i);
rts[v]=T1.upd(rts[v],1,m,i,i);
st[u]=i;ed[v]=i;
}
calc(1,0);
// printf("hey\n");
qr=1;ql=1;
for(int i=1;i<=ncnt;++i) if(!d[i]) qq[qr++]=i;
while(ql<qr){
int u=qq[ql++];if(u<=m) vis[u]=true;//printf("%d\n",u);
for(int pp=hd[u],v;pp;pp=nxt[pp]) if(!(--d[v=t[pp]])) qq[qr++]=v;
}
bool ok=true;
for(int i=1;i<=m;++i) if(!vis[i]){ok=false;break;}
if(ok) printf("Yes\n");
else printf("No\n");
for(int i=1;i<=n;++i) dels[i].clear(),st[i]=0,ed[i]=0,es[i].clear(),rts[i]=0;
for(int i=1;i<=m;++i) vis[i]=false;
memset(hd,0,sizeof(int)*(ncnt+5));memset(d,0,sizeof(int)*(ncnt+5));
/*printf("%d %d %d %d\n",cnt,ncnt,T1.cnt,T2.cnt);*/cnt=ncnt=0;T1.init();
}
return 0;
}
詳細信息
Subtask #1:
score: 5
Accepted
Test #1:
score: 5
Accepted
time: 7ms
memory: 20024kb
input:
1 2 1 2 2 1 2 2 1
output:
No
result:
ok single line: 'No'
Test #2:
score: 0
Accepted
time: 7ms
memory: 18352kb
input:
462 120 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 ...
output:
No Yes Yes No Yes No Yes No Yes No No Yes No No No No No No No No No Yes Yes Yes Yes No No Yes No No No No No No No Yes Yes No Yes No No No No No No No No No No No No No No No No Yes Yes Yes No Yes Yes No Yes Yes No Yes Yes No Yes Yes No No Yes Yes No No Yes No No Yes No No Yes No No Yes No No No Ye...
result:
ok 462 lines
Test #3:
score: 0
Accepted
time: 17ms
memory: 20028kb
input:
1000 120 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...
output:
No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No ...
result:
ok 1000 lines
Test #4:
score: 0
Accepted
time: 2ms
memory: 18728kb
input:
20 250 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:
Yes Yes Yes Yes Yes Yes No No Yes No No No Yes No No No Yes No No Yes
result:
ok 20 lines
Test #5:
score: 0
Accepted
time: 2ms
memory: 18484kb
input:
20 250 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:
Yes Yes Yes Yes Yes Yes No No No No No No No No No No No No No Yes
result:
ok 20 lines
Test #6:
score: 0
Accepted
time: 1ms
memory: 20200kb
input:
20 250 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:
Yes Yes Yes Yes Yes Yes No No No No No No No No No No No No No Yes
result:
ok 20 lines
Test #7:
score: 0
Accepted
time: 36ms
memory: 18932kb
input:
20 6000 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 ...
output:
Yes Yes Yes Yes Yes Yes No No No No No No No No No No No No No Yes
result:
ok 20 lines
Test #8:
score: 0
Accepted
time: 31ms
memory: 48204kb
input:
1 120000 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...
output:
Yes
result:
ok single line: 'Yes'
Test #9:
score: 0
Accepted
time: 8ms
memory: 18308kb
input:
1000 21 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 4 1 2 7 4 15 8 17 12 21 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 7 1 2 3 4 5 8 7 10 9 14 15 18 17 20 21 1 2 2 3 3 4 4 5 5 6 6 7...
output:
Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes ...
result:
ok 1000 lines
Test #10:
score: 0
Accepted
time: 62ms
memory: 20032kb
input:
1000 120 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...
output:
Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes ...
result:
ok 1000 lines
Test #11:
score: 0
Accepted
time: 474ms
memory: 244556kb
input:
1 120000 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...
output:
Yes
result:
ok single line: 'Yes'
Test #12:
score: 0
Accepted
time: 457ms
memory: 239912kb
input:
1 120000 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...
output:
No
result:
ok single line: 'No'
Test #13:
score: 0
Accepted
time: 662ms
memory: 253784kb
input:
1 120000 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...
output:
No
result:
ok single line: 'No'
Test #14:
score: 0
Accepted
time: 2241ms
memory: 580340kb
input:
1 120000 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...
output:
No
result:
ok single line: 'No'
Test #15:
score: 0
Accepted
time: 765ms
memory: 305932kb
input:
1 120000 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...
output:
Yes
result:
ok single line: 'Yes'
Test #16:
score: 0
Accepted
time: 978ms
memory: 471096kb
input:
1 120000 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...
output:
Yes
result:
ok single line: 'Yes'
Test #17:
score: 0
Accepted
time: 735ms
memory: 301920kb
input:
1 120000 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...
output:
Yes
result:
ok single line: 'Yes'
Test #18:
score: 0
Accepted
time: 708ms
memory: 296280kb
input:
1 120000 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...
output:
No
result:
ok single line: 'No'
Test #19:
score: 0
Accepted
time: 623ms
memory: 285524kb
input:
1 120000 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...
output:
No
result:
ok single line: 'No'
Test #20:
score: 0
Accepted
time: 550ms
memory: 192992kb
input:
1 120000 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...
output:
No
result:
ok single line: 'No'
Subtask #2:
score: 5
Accepted
Test #21:
score: 5
Accepted
time: 4ms
memory: 18332kb
input:
20 250 1 15 15 16 16 17 17 18 18 19 19 20 20 21 21 22 22 23 3 23 1 24 24 25 25 26 5 26 1 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 7 42 2 43 43 44 44 45 45 46 4 46 2 47 47 48 48 49 49 50 50 51 51 52 52 53 53 54 54 55 12 55 2 56 56 57 57 58 58 59 59 ...
output:
No No No No No No Yes Yes Yes Yes Yes Yes Yes No No No No No Yes Yes
result:
ok 20 lines
Test #22:
score: 0
Accepted
time: 3ms
memory: 20276kb
input:
20 250 1 15 15 16 16 17 17 18 18 19 19 20 20 21 21 22 22 23 3 23 1 24 24 25 25 26 26 27 27 28 28 29 29 30 30 31 31 32 5 32 1 33 33 34 34 35 35 36 36 37 37 38 38 39 39 40 40 41 7 41 2 42 42 43 43 44 44 45 45 46 46 47 4 47 2 48 48 49 49 50 50 51 51 52 52 53 53 54 12 54 2 55 55 56 56 57 57 58 58 59 14 ...
output:
Yes Yes Yes Yes Yes No No No No No Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes
result:
ok 20 lines
Test #23:
score: 0
Accepted
time: 1ms
memory: 17132kb
input:
20 250 1 15 15 16 16 17 17 18 18 19 19 20 20 21 21 22 22 23 23 24 3 24 1 25 25 26 26 27 27 28 28 29 29 30 30 31 5 31 1 32 32 33 33 34 34 35 35 36 36 37 37 38 38 39 7 39 2 40 40 41 41 42 42 43 43 44 44 45 45 46 46 47 47 48 4 48 2 49 49 50 50 51 51 52 52 53 53 54 54 55 55 56 56 57 57 58 12 58 2 59 59 ...
output:
Yes Yes Yes Yes Yes Yes No No No Yes Yes Yes Yes Yes Yes Yes Yes Yes No No
result:
ok 20 lines
Test #24:
score: 0
Accepted
time: 2ms
memory: 17680kb
input:
20 250 1 15 15 16 16 17 17 18 18 19 19 20 3 20 1 21 21 22 22 23 23 24 24 25 25 26 26 27 27 28 28 29 29 30 30 31 5 31 1 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 7 49 2 50 50 51 51 52 52 53 53 54 54 55 55 56 56 57 57 58 4 58 2 59 59 60 60...
output:
No Yes Yes Yes Yes Yes Yes Yes Yes Yes No No No Yes Yes Yes Yes Yes Yes Yes
result:
ok 20 lines
Test #25:
score: 0
Accepted
time: 2ms
memory: 18632kb
input:
20 250 1 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 3 31 1 32 32 33 33 34 34 35 35 36 36 37 37 38 38 39 5 39 1 40 40 41 41 42 42 43 43 44 44 45 7 45 2 46 46 47 47 48 48 49 49 50 50 51 4 51 2 52 52 53 53 54 54 55 55 56 56 57 57 58 58 59 59 60 12...
output:
Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes
result:
ok 20 lines
Test #26:
score: 0
Accepted
time: 1ms
memory: 18680kb
input:
20 250 1 15 15 16 16 17 17 18 18 19 19 20 3 20 1 21 21 22 22 23 23 24 24 25 25 26 26 27 5 27 1 28 28 29 29 30 30 31 31 32 32 33 33 34 34 35 35 36 36 37 7 37 2 38 38 39 39 40 40 41 41 42 42 43 43 44 44 45 45 46 4 46 2 47 47 48 12 48 2 49 49 50 50 51 14 51 3 52 52 53 53 54 54 55 55 56 56 57 57 58 58 5...
output:
Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes
result:
ok 20 lines
Test #27:
score: 0
Accepted
time: 0ms
memory: 17248kb
input:
20 250 1 15 15 16 16 17 17 18 18 19 19 20 20 21 3 21 1 22 22 23 23 24 24 25 5 25 1 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 7 39 2 40 40 41 41 42 42 43 43 44 44 45 45 46 46 47 4 47 2 48 48 49 49 50 50 51 51 52 52 53 53 54 54 55 55 56 12 56 2 57 57 58 58 59 59 ...
output:
Yes No No No No No No Yes Yes Yes Yes Yes Yes No No No No No No Yes
result:
ok 20 lines
Test #28:
score: 0
Accepted
time: 3ms
memory: 17556kb
input:
17 250 1 15 15 16 16 17 17 18 18 19 19 20 20 21 3 21 1 22 22 23 23 24 24 25 25 26 26 27 27 28 5 28 1 29 29 30 30 31 31 32 32 33 33 34 34 35 35 36 36 37 37 38 38 39 7 39 2 40 40 41 41 42 4 42 2 43 43 44 44 45 45 46 46 47 47 48 48 49 49 50 50 51 51 52 52 53 53 54 12 54 2 55 55 56 56 57 57 58 58 59 59 ...
output:
Yes Yes Yes Yes Yes No No No No No No Yes Yes Yes Yes Yes Yes
result:
ok 17 lines
Test #29:
score: 0
Accepted
time: 1ms
memory: 20092kb
input:
20 4 1 2 1 3 1 4 2 1 4 4 1 250 1 2 1 3 1 4 1 5 1 6 1 7 1 8 1 9 1 10 1 11 1 12 1 13 1 14 1 15 1 16 1 17 1 18 1 19 1 20 1 21 1 22 1 23 1 24 1 25 1 26 1 27 1 28 1 29 1 30 1 31 1 32 1 33 1 34 1 35 1 36 1 37 1 38 1 39 1 40 1 41 1 42 1 43 1 44 1 45 1 46 1 47 1 48 1 49 1 50 1 51 1 52 1 53 1 54 1 55 1 56 1 ...
output:
No No Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes No Yes No Yes Yes Yes Yes
result:
ok 20 lines
Test #30:
score: 0
Accepted
time: 3ms
memory: 18356kb
input:
20 7 1 2 1 3 2 4 2 5 3 6 3 7 2 1 2 2 1 250 1 2 1 3 2 4 2 5 3 6 3 7 4 8 4 9 5 10 5 11 6 12 6 13 7 14 7 15 8 16 8 17 9 18 9 19 10 20 10 21 11 22 11 23 12 24 12 25 13 26 13 27 14 28 14 29 15 30 15 31 16 32 16 33 17 34 17 35 18 36 18 37 19 38 19 39 20 40 20 41 21 42 21 43 22 44 22 45 23 46 23 47 24 48 2...
output:
No No Yes No Yes Yes No Yes Yes Yes Yes Yes Yes Yes Yes No Yes Yes Yes Yes
result:
ok 20 lines
Subtask #3:
score: 16
Accepted
Dependency #2:
100%
Accepted
Test #31:
score: 16
Accepted
time: 4ms
memory: 17400kb
input:
20 250 1 2 1 3 3 4 2 5 4 6 6 7 1 8 6 9 8 10 7 11 4 12 11 13 8 14 14 15 1 16 15 17 17 18 11 19 2 20 13 21 2 22 2 23 12 24 14 25 22 26 23 27 12 28 17 29 22 30 30 31 14 32 10 33 5 34 15 35 26 36 10 37 21 38 22 39 2 40 31 41 20 42 22 43 43 44 26 45 36 46 5 47 10 48 45 49 15 50 34 51 49 52 15 53 3 54 28 ...
output:
Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes
result:
ok 20 lines
Test #32:
score: 0
Accepted
time: 8ms
memory: 17180kb
input:
20 250 1 2 2 3 3 4 2 5 3 6 5 7 6 8 8 9 9 10 9 11 9 12 9 13 13 14 12 15 13 16 13 17 15 18 15 19 19 20 17 21 21 22 19 23 21 24 21 25 23 26 25 27 26 28 26 29 28 30 30 31 28 32 29 33 32 34 32 35 32 36 35 37 35 38 37 39 37 40 38 41 39 42 40 43 41 44 43 45 45 46 45 47 44 48 48 49 47 50 47 51 50 52 49 53 5...
output:
Yes No No No Yes No No Yes No No Yes No No No Yes Yes No Yes No No
result:
ok 20 lines
Test #33:
score: 0
Accepted
time: 1ms
memory: 17372kb
input:
20 15 1 2 1 3 3 4 4 5 2 6 6 7 5 8 6 9 9 10 8 11 8 12 11 13 12 14 13 15 3 15 14 14 10 10 7 15 1 2 1 3 1 4 2 5 2 6 6 7 6 8 8 9 8 10 9 11 10 12 11 13 11 14 14 15 3 3 7 4 15 12 3 15 1 2 1 3 3 4 1 5 4 6 6 7 5 8 8 9 7 10 10 11 8 12 9 13 12 14 14 15 3 13 11 2 15 15 13 15 1 2 1 3 1 4 4 5 4 6 3 7 7 8 8 9 6 1...
output:
Yes Yes Yes Yes Yes Yes No Yes Yes No No No No Yes Yes Yes Yes Yes Yes No
result:
ok 20 lines
Test #34:
score: 0
Accepted
time: 3ms
memory: 18440kb
input:
20 250 1 2 2 3 1 4 1 5 3 6 5 7 5 8 5 9 8 10 7 11 8 12 12 13 10 14 12 15 12 16 13 17 14 18 15 19 19 20 20 21 21 22 19 23 20 24 23 25 25 26 23 27 26 28 27 29 28 30 27 31 29 32 32 33 30 34 32 35 34 36 36 37 36 38 37 39 38 40 39 41 41 42 40 43 43 44 41 45 44 46 44 47 47 48 46 49 47 50 47 51 49 52 49 53 ...
output:
Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes No No Yes No No Yes Yes No No Yes
result:
ok 20 lines
Test #35:
score: 0
Accepted
time: 1ms
memory: 17136kb
input:
20 250 1 2 2 3 2 4 4 5 3 6 6 7 6 8 6 9 9 10 9 11 9 12 12 13 11 14 12 15 15 16 14 17 17 18 18 19 17 20 18 21 19 22 21 23 21 24 22 25 25 26 26 27 26 28 28 29 29 30 28 31 30 32 32 33 31 34 32 35 34 36 34 37 35 38 36 39 38 40 40 41 41 42 41 43 42 44 44 45 43 46 44 47 47 48 48 49 49 50 48 51 50 52 52 53 ...
output:
Yes Yes Yes Yes Yes No No Yes Yes No No Yes No Yes No No No Yes No Yes
result:
ok 20 lines
Test #36:
score: 0
Accepted
time: 1ms
memory: 17116kb
input:
20 250 1 2 1 3 1 4 1 5 1 6 1 7 1 8 1 9 1 10 1 11 1 12 1 13 1 14 1 15 1 16 1 17 1 18 1 19 1 20 1 21 1 22 1 23 1 24 1 25 1 26 1 27 1 28 1 29 1 30 1 31 1 32 1 33 1 34 1 35 1 36 1 37 1 38 1 39 1 40 1 41 1 42 1 43 1 44 1 45 1 46 1 47 1 48 1 49 1 50 1 51 1 52 1 53 1 54 1 55 1 56 1 57 1 58 1 59 1 60 1 61 1...
output:
No No No No No No No Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes
result:
ok 20 lines
Test #37:
score: 0
Accepted
time: 4ms
memory: 18804kb
input:
20 12 1 2 2 3 2 4 4 5 1 6 7 8 8 9 8 10 10 11 7 12 1 7 6 1 12 2 11 3 10 4 9 5 8 6 7 12 1 2 1 3 1 4 1 5 1 6 7 8 7 9 7 10 7 11 7 12 1 7 6 1 8 2 7 3 9 4 12 5 11 6 10 12 1 2 2 3 1 4 1 5 4 6 7 8 8 9 7 10 7 11 10 12 1 7 6 1 9 2 8 3 11 4 10 5 12 6 7 12 1 2 2 3 2 4 2 5 1 6 7 8 8 9 8 10 8 11 7 12 1 7 6 1 9 2 ...
output:
Yes Yes Yes Yes No No No No No No Yes Yes Yes Yes Yes No Yes No Yes No
result:
ok 20 lines
Test #38:
score: 0
Accepted
time: 4ms
memory: 18632kb
input:
20 7 1 5 1 4 1 7 1 3 1 6 1 2 5 3 5 6 3 2 4 4 6 7 2 7 2 6 2 5 2 7 2 4 1 2 2 3 6 5 7 3 1 7 3 6 4 1 6 4 5 7 1 6 1 7 1 5 1 2 1 4 1 3 6 6 4 2 3 7 6 5 2 4 5 3 7 7 2 7 4 7 6 7 1 7 3 7 5 7 5 1 3 7 6 3 5 4 2 5 4 7 2 7 6 7 5 7 1 7 3 7 4 7 6 6 1 7 2 2 3 3 4 5 6 4 5 13 1 5 1 11 6 8 5 13 2 7 4 9 5 7 3 5 5 8 3 10...
output:
Yes No No Yes No Yes No No Yes No No Yes Yes Yes Yes Yes Yes Yes No Yes
result:
ok 20 lines
Test #39:
score: 0
Accepted
time: 4ms
memory: 18860kb
input:
20 246 114 183 25 82 127 221 7 59 176 220 155 244 15 67 52 230 191 222 92 127 81 103 13 61 103 110 75 80 126 141 135 187 60 192 79 151 118 147 61 188 134 173 125 147 216 236 40 62 177 212 112 133 105 198 131 205 146 168 135 167 202 231 200 232 88 209 131 176 104 159 116 245 136 223 13 91 80 134 105 ...
output:
Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes No No No No No No No No No No
result:
ok 20 lines
Test #40:
score: 0
Accepted
time: 0ms
memory: 17664kb
input:
20 23 1 2 2 3 3 4 4 5 5 6 5 7 4 8 3 9 2 10 1 11 12 13 13 14 14 15 15 16 16 17 16 18 15 19 14 20 13 21 12 22 1 23 12 23 6 11 17 10 18 9 19 8 20 7 21 6 22 23 1 2 2 3 3 4 4 5 5 6 5 7 4 8 3 9 2 10 1 11 12 13 13 14 14 15 15 16 16 17 16 18 15 19 14 20 13 21 12 22 1 23 12 23 6 11 17 10 18 9 19 8 20 7 21 6 ...
output:
Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes No Yes
result:
ok 20 lines
Test #41:
score: 0
Accepted
time: 4ms
memory: 19976kb
input:
20 250 1 2 1 3 2 4 4 5 3 6 1 7 2 8 1 9 9 10 9 11 11 12 12 13 9 14 14 15 11 16 4 17 11 18 9 19 10 20 15 21 16 22 4 23 17 24 6 25 2 26 19 27 14 28 21 29 13 30 14 31 21 32 21 33 31 34 3 35 5 36 19 37 27 38 6 39 3 40 12 41 33 42 25 43 13 44 40 45 28 46 25 47 37 48 31 49 40 50 45 51 28 52 16 53 37 54 2 5...
output:
No Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes
result:
ok 20 lines
Test #42:
score: 0
Accepted
time: 2ms
memory: 17156kb
input:
20 23 1 2 2 3 3 4 4 5 5 6 5 7 4 8 3 9 2 10 1 11 12 13 13 14 14 15 15 16 16 17 16 18 15 19 14 20 13 21 12 22 1 23 12 23 6 7 18 8 22 9 21 10 20 11 19 5 16 23 1 2 2 3 3 4 4 5 5 6 5 7 4 8 3 9 2 10 1 11 12 13 13 14 14 15 15 16 16 17 16 18 15 19 14 20 13 21 12 22 1 23 12 23 6 7 18 8 22 9 21 10 20 11 19 5 ...
output:
No No No No No No No No No No No No No No No No No No No No
result:
ok 20 lines
Subtask #4:
score: 28
Accepted
Dependency #3:
100%
Accepted
Test #43:
score: 28
Accepted
time: 5ms
memory: 17812kb
input:
20 250 1 2 2 3 3 4 1 5 1 6 1 7 7 8 1 9 3 10 5 11 11 12 10 13 9 14 2 15 14 16 8 17 6 18 9 19 12 20 10 21 13 22 2 23 15 24 5 25 1 26 9 27 21 28 12 29 13 30 9 31 31 32 25 33 27 34 15 35 2 36 17 37 5 38 36 39 16 40 4 41 28 42 7 43 28 44 5 45 11 46 36 47 29 48 13 49 28 50 35 51 51 52 24 53 35 54 23 55 42...
output:
No No No Yes Yes No No No No Yes No No No No No No No No No No
result:
ok 20 lines
Test #44:
score: 0
Accepted
time: 9ms
memory: 18464kb
input:
20 250 1 2 1 3 2 4 3 5 4 6 5 7 4 8 8 9 7 10 10 11 11 12 12 13 13 14 12 15 13 16 13 17 17 18 18 19 16 20 20 21 18 22 21 23 20 24 24 25 22 26 26 27 24 28 28 29 27 30 30 31 30 32 29 33 31 34 32 35 35 36 33 37 35 38 37 39 37 40 39 41 38 42 40 43 41 44 42 45 44 46 44 47 47 48 45 49 46 50 47 51 50 52 50 5...
output:
No No No No No No No No No No No No No No No No No No No No
result:
ok 20 lines
Test #45:
score: 0
Accepted
time: 5ms
memory: 20296kb
input:
20 250 1 2 1 3 2 4 2 5 3 6 3 7 7 8 6 9 6 10 7 11 8 12 9 13 11 14 13 15 12 16 14 17 15 18 16 19 18 20 17 21 19 22 20 23 23 24 21 25 24 26 24 27 26 28 27 29 26 30 27 31 29 32 29 33 33 34 32 35 34 36 35 37 37 38 37 39 39 40 37 41 38 42 39 43 40 44 43 45 45 46 46 47 44 48 46 49 47 50 48 51 50 52 50 53 5...
output:
No Yes Yes Yes Yes Yes Yes No Yes No No Yes Yes No No No No No Yes No
result:
ok 20 lines
Test #46:
score: 0
Accepted
time: 4ms
memory: 17412kb
input:
20 250 1 2 2 3 1 4 2 5 1 6 5 7 2 8 8 9 5 10 8 11 4 12 9 13 10 14 11 15 8 16 14 17 8 18 15 19 15 20 18 21 15 22 17 23 14 24 18 25 20 26 17 27 22 28 19 29 21 30 29 31 28 32 23 33 29 34 27 35 26 36 29 37 27 38 36 39 37 40 39 41 37 42 37 43 38 44 39 45 44 46 37 47 44 48 38 49 44 50 42 51 45 52 45 53 49 ...
output:
No No No Yes Yes Yes Yes Yes No No No Yes No No Yes Yes No Yes No No
result:
ok 20 lines
Test #47:
score: 0
Accepted
time: 8ms
memory: 18940kb
input:
20 200 1 2 2 3 1 4 4 5 5 6 1 7 6 8 2 9 1 10 3 11 9 12 8 13 4 14 2 15 15 16 2 17 17 18 6 19 17 20 19 21 8 22 13 23 10 24 10 25 24 26 2 27 11 28 28 29 24 30 29 31 7 32 22 33 20 34 9 35 5 36 18 37 30 38 11 39 25 40 30 41 8 42 3 43 2 44 26 45 28 46 34 47 32 48 41 49 38 50 24 51 35 52 48 53 3 54 31 55 36...
output:
No No No No No No No No No No Yes Yes Yes Yes Yes No No Yes No Yes
result:
ok 20 lines
Test #48:
score: 0
Accepted
time: 0ms
memory: 17616kb
input:
20 200 1 2 1 3 3 4 4 5 5 6 5 7 7 8 6 9 8 10 9 11 9 12 10 13 12 14 12 15 14 16 14 17 16 18 18 19 17 20 19 21 19 22 20 23 22 24 22 25 24 26 24 27 25 28 26 29 28 30 29 31 29 32 31 33 32 34 34 35 33 36 34 37 36 38 36 39 37 40 40 41 41 42 41 43 42 44 43 45 45 46 45 47 47 48 48 49 49 50 50 51 50 52 52 53 ...
output:
No No No No No No No No No No Yes Yes Yes Yes Yes No No No No No
result:
ok 20 lines
Test #49:
score: 0
Accepted
time: 10ms
memory: 18468kb
input:
20 101 46 88 46 52 46 77 46 67 5 46 46 91 11 46 46 74 46 90 26 46 46 51 13 46 46 83 23 46 1 46 46 58 39 46 38 46 37 46 46 79 10 46 46 95 46 94 46 81 46 61 45 46 46 71 46 84 46 50 46 72 46 57 46 47 46 101 32 46 29 46 4 46 31 46 46 80 3 46 7 46 46 66 34 46 6 46 19 46 22 46 46 97 18 46 46 68 46 82 40 4...
output:
Yes No No Yes No Yes No No Yes No No Yes Yes Yes Yes Yes Yes Yes Yes No
result:
ok 20 lines
Test #50:
score: 0
Accepted
time: 5ms
memory: 20056kb
input:
20 15 1 11 14 15 9 14 8 9 9 10 11 12 6 9 2 11 2 3 6 7 1 13 4 9 5 15 2 14 7 10 11 4 14 7 9 8 2 3 1 5 13 12 15 15 10 13 1 8 4 15 1 11 3 14 1 14 3 5 9 10 3 9 4 12 7 9 2 12 1 6 1 4 7 15 1 2 4 11 9 6 14 5 10 7 13 8 3 15 7 12 2 3 8 9 2 13 1 7 4 7 1 9 9 10 9 14 3 6 1 5 2 11 1 3 14 15 7 15 9 12 11 5 3 13 4 ...
output:
Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes
result:
ok 20 lines
Subtask #5:
score: 12
Accepted
Dependency #4:
100%
Accepted
Test #51:
score: 12
Accepted
time: 48ms
memory: 19748kb
input:
20 6000 1 2 1 3 2 4 4 5 5 6 5 7 1 8 3 9 3 10 8 11 1 12 7 13 3 14 1 15 10 16 9 17 13 18 13 19 7 20 20 21 21 22 14 23 11 24 7 25 22 26 23 27 9 28 20 29 15 30 8 31 23 32 3 33 33 34 22 35 20 36 26 37 21 38 21 39 1 40 4 41 34 42 17 43 14 44 7 45 13 46 43 47 4 48 19 49 42 50 4 51 12 52 29 53 29 54 12 55 5...
output:
No No No No No No No No No No No No No No No No No No No No
result:
ok 20 lines
Test #52:
score: 0
Accepted
time: 53ms
memory: 19172kb
input:
20 6000 1 2 2 3 2 4 3 5 4 6 4 7 5 8 6 9 6 10 10 11 10 12 2 13 13 14 5 15 15 16 12 17 12 18 18 19 1 20 5 21 12 22 19 23 9 24 14 25 17 26 17 27 13 28 1 29 13 30 9 31 27 32 15 33 28 34 25 35 33 36 12 37 2 38 37 39 5 40 25 41 34 42 17 43 40 44 38 45 14 46 2 47 31 48 42 49 18 50 45 51 44 52 35 53 14 54 1...
output:
Yes Yes Yes No Yes Yes Yes No Yes No No Yes No Yes Yes Yes No Yes Yes Yes
result:
ok 20 lines
Test #53:
score: 0
Accepted
time: 35ms
memory: 21360kb
input:
20 6000 1 2 1 3 1 4 1 5 1 6 1 7 1 8 1 9 1 10 1 11 1 12 1 13 1 14 1 15 1 16 1 17 1 18 1 19 1 20 1 21 1 22 1 23 1 24 1 25 1 26 1 27 1 28 1 29 1 30 1 31 1 32 1 33 1 34 1 35 1 36 1 37 1 38 1 39 1 40 1 41 1 42 1 43 1 44 1 45 1 46 1 47 1 48 1 49 1 50 1 51 1 52 1 53 1 54 1 55 1 56 1 57 1 58 1 59 1 60 1 61 ...
output:
No No No No No No No Yes Yes No No No No Yes Yes Yes Yes No Yes Yes
result:
ok 20 lines
Test #54:
score: 0
Accepted
time: 22ms
memory: 21020kb
input:
20 6000 1 2 2 3 3 4 4 5 2 6 5 7 5 8 6 9 6 10 9 11 10 12 12 13 10 14 14 15 15 16 13 17 15 18 15 19 19 20 17 21 21 22 19 23 23 24 23 25 22 26 26 27 25 28 26 29 29 30 28 31 29 32 30 33 30 34 32 35 32 36 36 37 37 38 38 39 36 40 37 41 40 42 39 43 43 44 43 45 45 46 43 47 46 48 47 49 47 50 50 51 48 52 50 5...
output:
Yes Yes No Yes No No Yes Yes Yes Yes Yes No Yes No No Yes Yes No No No
result:
ok 20 lines
Test #55:
score: 0
Accepted
time: 22ms
memory: 21400kb
input:
20 1000 1 2 2 3 1 4 3 5 4 6 6 7 1 8 1 9 9 10 1 11 6 12 1 13 1 14 14 15 12 16 10 17 1 18 11 19 10 20 14 21 18 22 2 23 2 24 7 25 17 26 24 27 4 28 28 29 8 30 30 31 3 32 28 33 28 34 34 35 5 36 25 37 32 38 7 39 31 40 26 41 29 42 33 43 27 44 34 45 18 46 19 47 23 48 29 49 29 50 21 51 19 52 52 53 19 54 48 5...
output:
No No No No No No No No No No Yes Yes Yes Yes Yes Yes No Yes No No
result:
ok 20 lines
Test #56:
score: 0
Accepted
time: 54ms
memory: 23632kb
input:
1 120000 1 2 2 3 3 4 3 5 5 6 3 7 3 8 2 9 2 10 7 11 3 12 3 13 9 14 11 15 9 16 6 17 13 18 18 19 6 20 1 21 12 22 8 23 5 24 12 25 7 26 8 27 4 28 21 29 3 30 21 31 13 32 2 33 28 34 33 35 21 36 31 37 1 38 22 39 9 40 34 41 2 42 22 43 5 44 34 45 35 46 8 47 22 48 20 49 2 50 42 51 23 52 30 53 26 54 17 55 40 56...
output:
No
result:
ok single line: 'No'
Test #57:
score: 0
Accepted
time: 52ms
memory: 25852kb
input:
1 120000 1 2 2 3 2 4 4 5 3 6 1 7 5 8 4 9 5 10 4 11 9 12 12 13 5 14 9 15 10 16 1 17 10 18 3 19 5 20 8 21 9 22 12 23 17 24 9 25 2 26 19 27 1 28 12 29 6 30 20 31 3 32 9 33 12 34 27 35 27 36 20 37 16 38 6 39 29 40 24 41 26 42 26 43 22 44 13 45 11 46 24 47 23 48 7 49 37 50 44 51 27 52 14 53 27 54 25 55 5...
output:
Yes
result:
ok single line: 'Yes'
Test #58:
score: 0
Accepted
time: 32ms
memory: 34332kb
input:
1 120000 1 2 1 3 2 4 2 5 4 6 4 7 5 8 6 9 8 10 8 11 10 12 10 13 13 14 12 15 13 16 14 17 17 18 16 19 18 20 20 21 21 22 20 23 22 24 22 25 23 26 24 27 25 28 27 29 27 30 30 31 31 32 32 33 33 34 34 35 35 36 34 37 36 38 36 39 37 40 38 41 40 42 41 43 43 44 42 45 43 46 44 47 47 48 47 49 49 50 49 51 50 52 50 ...
output:
Yes
result:
ok single line: 'Yes'
Test #59:
score: 0
Accepted
time: 39ms
memory: 34464kb
input:
1 120000 1 2 1 3 2 4 2 5 3 6 6 7 5 8 6 9 9 10 9 11 10 12 11 13 13 14 13 15 15 16 15 17 15 18 18 19 18 20 20 21 19 22 22 23 23 24 23 25 25 26 26 27 25 28 28 29 27 30 29 31 29 32 32 33 31 34 34 35 33 36 36 37 35 38 36 39 38 40 38 41 40 42 42 43 43 44 44 45 45 46 45 47 46 48 46 49 49 50 49 51 50 52 50 ...
output:
Yes
result:
ok single line: 'Yes'
Test #60:
score: 0
Accepted
time: 39ms
memory: 21716kb
input:
1 120000 1 2 2 3 2 4 3 5 5 6 4 7 1 8 6 9 2 10 1 11 9 12 1 13 11 14 6 15 3 16 11 17 7 18 18 19 18 20 6 21 3 22 12 23 20 24 4 25 18 26 11 27 15 28 10 29 10 30 5 31 12 32 13 33 15 34 26 35 24 36 4 37 16 38 32 39 36 40 17 41 11 42 33 43 19 44 18 45 16 46 38 47 10 48 6 49 36 50 37 51 51 52 7 53 20 54 9 5...
output:
No
result:
ok single line: 'No'
Test #61:
score: 0
Accepted
time: 46ms
memory: 22720kb
input:
1 120000 1 2 1 3 3 4 1 5 5 6 4 7 6 8 3 9 1 10 9 11 10 12 3 13 13 14 4 15 3 16 16 17 7 18 6 19 18 20 3 21 10 22 15 23 7 24 14 25 24 26 20 27 27 28 13 29 2 30 29 31 28 32 20 33 31 34 24 35 33 36 30 37 35 38 1 39 23 40 32 41 31 42 37 43 34 44 7 45 2 46 25 47 39 48 10 49 36 50 50 51 1 52 40 53 9 54 19 5...
output:
Yes
result:
ok single line: 'Yes'
Test #62:
score: 0
Accepted
time: 37ms
memory: 27992kb
input:
1 120000 1 2 2 3 3 4 2 5 5 6 2 7 6 8 5 9 9 10 2 11 6 12 8 13 9 14 9 15 12 16 7 17 11 18 11 19 11 20 13 21 19 22 20 23 23 24 18 25 18 26 20 27 25 28 24 29 27 30 22 31 24 32 31 33 24 34 25 35 28 36 34 37 28 38 30 39 34 40 32 41 38 42 33 43 39 44 40 45 41 46 44 47 43 48 43 49 42 50 42 51 42 52 45 53 47...
output:
Yes
result:
ok single line: 'Yes'
Test #63:
score: 0
Accepted
time: 36ms
memory: 25672kb
input:
1 120000 1 2 2 3 2 4 4 5 1 6 6 7 3 8 1 9 2 10 5 11 8 12 12 13 5 14 8 15 14 16 15 17 7 18 18 19 14 20 10 21 12 22 22 23 23 24 24 25 23 26 24 27 25 28 27 29 20 30 24 31 30 32 23 33 24 34 34 35 31 36 34 37 36 38 38 39 31 40 33 41 38 42 35 43 37 44 39 45 38 46 41 47 37 48 39 49 48 50 43 51 47 52 51 53 4...
output:
No
result:
ok single line: 'No'
Test #64:
score: 0
Accepted
time: 29ms
memory: 16668kb
input:
20 501 190 352 328 352 288 352 304 352 9 352 307 352 352 385 352 499 221 352 309 352 137 352 223 352 142 352 8 352 270 352 229 352 265 352 228 352 218 352 19 352 259 352 199 352 267 352 344 352 85 352 166 352 156 352 99 352 352 489 281 352 121 352 83 352 14 352 352 384 352 455 352 403 186 352 330 35...
output:
Yes No No Yes No Yes No No Yes No No Yes Yes Yes Yes Yes Yes Yes Yes Yes
result:
ok 20 lines
Test #65:
score: 0
Accepted
time: 57ms
memory: 21564kb
input:
1 120000 9596 32034 82692 85993 30880 60468 22127 89935 44536 51056 29638 71986 57153 103961 11021 66919 65177 96684 4542 48982 10457 21422 10762 52690 76467 105536 31498 46755 48690 82310 13509 118283 15463 106906 7541 66632 74654 103950 58261 68753 15087 48231 31649 96398 69483 90580 36955 85619 2...
output:
Yes
result:
ok single line: 'Yes'
Subtask #6:
score: 0
Time Limit Exceeded
Test #66:
score: 11
Accepted
time: 48ms
memory: 15084kb
input:
1000 10 1 2 2 3 1 4 4 5 4 6 4 7 2 8 8 9 3 10 2 5 4 1 9 10 1 2 1 3 1 4 4 5 4 6 3 7 3 8 2 9 6 10 2 2 9 1 5 10 1 2 2 3 1 4 4 5 4 6 2 7 3 8 2 9 1 10 2 10 2 7 5 10 1 2 1 3 1 4 2 5 1 6 3 7 2 8 7 9 2 10 2 10 5 2 7 10 1 2 1 3 1 4 3 5 5 6 3 7 7 8 1 9 8 10 2 6 7 1 2 10 1 2 1 3 3 4 2 5 4 6 3 7 1 8 4 9 1 10 2 1...
output:
Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes No No No Yes Yes Yes Yes Yes No Yes Yes No No No No No No Yes No Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes No No Yes Yes No Yes Yes Yes Yes Yes Yes Yes Yes No Yes Yes Yes Yes Yes No Yes Yes ...
result:
ok 1000 lines
Test #67:
score: 0
Accepted
time: 58ms
memory: 15480kb
input:
1000 120 1 2 2 3 1 4 1 5 2 6 3 7 3 8 3 9 6 10 4 11 8 12 6 13 1 14 6 15 11 16 3 17 17 18 5 19 1 20 16 21 18 22 21 23 14 24 20 25 6 26 13 27 4 28 23 29 29 30 2 31 14 32 18 33 9 34 13 35 17 36 2 37 7 38 20 39 26 40 22 41 37 42 30 43 43 44 42 45 9 46 43 47 29 48 9 49 45 50 49 51 48 52 9 53 20 54 9 55 5 ...
output:
Yes Yes Yes Yes Yes Yes Yes No Yes Yes Yes Yes Yes Yes No Yes Yes Yes Yes No Yes Yes Yes Yes Yes Yes Yes Yes Yes No No Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes No No Yes Yes Yes Yes Yes Yes Yes Yes No Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes No Yes Yes Y...
result:
ok 1000 lines
Test #68:
score: 0
Accepted
time: 54ms
memory: 15948kb
input:
1000 120 1 2 2 3 1 4 1 5 3 6 1 7 7 8 2 9 1 10 5 11 5 12 7 13 4 14 11 15 10 16 15 17 10 18 1 19 18 20 8 21 14 22 4 23 8 24 9 25 5 26 20 27 9 28 11 29 19 30 8 31 6 32 30 33 2 34 14 35 30 36 3 37 11 38 17 39 14 40 39 41 18 42 36 43 37 44 29 45 32 46 42 47 29 48 16 49 3 50 47 51 16 52 3 53 36 54 24 55 5...
output:
No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No ...
result:
ok 1000 lines
Test #69:
score: 0
Accepted
time: 204ms
memory: 54556kb
input:
1 120000 1 2 1 3 3 4 4 5 1 6 5 7 7 8 4 9 7 10 4 11 7 12 10 13 5 14 6 15 15 16 3 17 15 18 1 19 10 20 2 21 18 22 16 23 12 24 23 25 2 26 12 27 8 28 5 29 12 30 30 31 23 32 7 33 16 34 25 35 5 36 8 37 19 38 6 39 30 40 4 41 33 42 27 43 43 44 27 45 44 46 22 47 26 48 29 49 29 50 28 51 9 52 20 53 41 54 1 55 4...
output:
No
result:
ok single line: 'No'
Test #70:
score: 0
Accepted
time: 838ms
memory: 255260kb
input:
1 120000 1 2 2 3 2 4 4 5 4 6 6 7 6 8 4 9 7 10 3 11 8 12 11 13 5 14 13 15 4 16 2 17 9 18 4 19 12 20 7 21 7 22 7 23 13 24 18 25 1 26 21 27 5 28 16 29 9 30 30 31 29 32 24 33 9 34 27 35 16 36 5 37 36 38 10 39 5 40 16 41 27 42 41 43 24 44 26 45 7 46 44 47 30 48 33 49 42 50 11 51 5 52 38 53 13 54 43 55 19...
output:
No
result:
ok single line: 'No'
Test #71:
score: 0
Accepted
time: 1422ms
memory: 511920kb
input:
1 120000 1 2 1 3 2 4 3 5 3 6 2 7 3 8 4 9 5 10 2 11 3 12 9 13 12 14 1 15 13 16 2 17 11 18 10 19 14 20 1 21 20 22 8 23 9 24 20 25 13 26 13 27 19 28 10 29 26 30 4 31 25 32 28 33 30 34 26 35 35 36 17 37 21 38 28 39 39 40 1 41 26 42 26 43 26 44 42 45 44 46 23 47 11 48 29 49 32 50 10 51 25 52 50 53 36 54 ...
output:
No
result:
ok single line: 'No'
Test #72:
score: 0
Accepted
time: 573ms
memory: 97932kb
input:
1 120000 1 2 2 3 2 4 2 5 5 6 5 7 1 8 2 9 9 10 9 11 3 12 11 13 4 14 3 15 5 16 10 17 17 18 6 19 13 20 7 21 2 22 11 23 13 24 18 25 23 26 6 27 22 28 24 29 2 30 24 31 30 32 6 33 16 34 31 35 30 36 31 37 6 38 38 39 32 40 19 41 41 42 31 43 39 44 40 45 45 46 7 47 11 48 8 49 49 50 6 51 38 52 17 53 28 54 12 55...
output:
Yes
result:
ok single line: 'Yes'
Test #73:
score: 0
Accepted
time: 399ms
memory: 91616kb
input:
1 120000 1 2 1 3 3 4 1 5 5 6 5 7 3 8 6 9 2 10 5 11 2 12 7 13 6 14 10 15 2 16 13 17 7 18 14 19 10 20 12 21 6 22 4 23 19 24 13 25 16 26 16 27 15 28 12 29 15 30 27 31 17 32 29 33 1 34 1 35 1 36 36 37 4 38 38 39 18 40 14 41 21 42 13 43 25 44 43 45 36 46 4 47 40 48 6 49 42 50 10 51 29 52 12 53 22 54 28 5...
output:
No
result:
ok single line: 'No'
Test #74:
score: 0
Accepted
time: 576ms
memory: 97036kb
input:
1 120000 1 2 2 3 1 4 1 5 4 6 6 7 5 8 1 9 5 10 9 11 1 12 8 13 10 14 6 15 15 16 13 17 1 18 11 19 9 20 7 21 4 22 5 23 4 24 12 25 18 26 17 27 1 28 23 29 11 30 18 31 27 32 19 33 21 34 19 35 23 36 1 37 32 38 38 39 27 40 36 41 41 42 30 43 39 44 34 45 18 46 34 47 28 48 35 49 2 50 43 51 17 52 4 53 41 54 41 5...
output:
Yes
result:
ok single line: 'Yes'
Test #75:
score: 0
Accepted
time: 1022ms
memory: 260116kb
input:
1 120000 1 2 1 3 1 4 2 5 1 6 4 7 6 8 2 9 9 10 1 11 10 12 9 13 12 14 4 15 1 16 9 17 13 18 10 19 6 20 8 21 6 22 12 23 11 24 19 25 1 26 9 27 20 28 24 29 6 30 13 31 17 32 23 33 23 34 6 35 25 36 36 37 17 38 3 39 18 40 4 41 8 42 17 43 8 44 21 45 21 46 21 47 5 48 4 49 17 50 22 51 14 52 18 53 49 54 30 55 29...
output:
No
result:
ok single line: 'No'
Test #76:
score: 0
Accepted
time: 784ms
memory: 246464kb
input:
1 120000 1 2 2 3 2 4 2 5 3 6 1 7 6 8 3 9 9 10 2 11 1 12 8 13 7 14 13 15 3 16 4 17 14 18 9 19 15 20 4 21 19 22 5 23 20 24 12 25 9 26 20 27 3 28 20 29 4 30 18 31 10 32 32 33 17 34 25 35 19 36 28 37 8 38 10 39 7 40 6 41 24 42 21 43 25 44 37 45 23 46 32 47 36 48 40 49 46 50 30 51 9 52 31 53 27 54 1 55 2...
output:
No
result:
ok single line: 'No'
Test #77:
score: 0
Accepted
time: 1333ms
memory: 268952kb
input:
1 120000 1 2 1 3 1 4 1 5 3 6 4 7 4 8 6 9 7 10 10 11 7 12 2 13 9 14 6 15 8 16 3 17 17 18 15 19 10 20 9 21 10 22 13 23 21 24 20 25 3 26 1 27 6 28 25 29 14 30 16 31 2 32 17 33 20 34 9 35 14 36 21 37 23 38 17 39 19 40 11 41 4 42 17 43 37 44 34 45 32 46 25 47 27 48 21 49 18 50 4 51 14 52 34 53 40 54 48 5...
output:
Yes
result:
ok single line: 'Yes'
Test #78:
score: 0
Accepted
time: 1319ms
memory: 267736kb
input:
1 120000 1 2 2 3 3 4 3 5 5 6 1 7 4 8 3 9 8 10 9 11 6 12 9 13 8 14 5 15 8 16 10 17 13 18 18 19 6 20 18 21 5 22 16 23 1 24 24 25 7 26 20 27 18 28 27 29 20 30 10 31 6 32 14 33 8 34 6 35 34 36 23 37 14 38 9 39 19 40 32 41 26 42 3 43 3 44 6 45 29 46 21 47 20 48 32 49 33 50 29 51 49 52 41 53 44 54 20 55 8...
output:
No
result:
ok single line: 'No'
Test #79:
score: 0
Accepted
time: 1282ms
memory: 268916kb
input:
1 120000 1 2 1 3 2 4 2 5 2 6 1 7 4 8 7 9 8 10 4 11 2 12 12 13 8 14 5 15 6 16 14 17 2 18 4 19 15 20 10 21 10 22 21 23 7 24 13 25 17 26 13 27 5 28 24 29 12 30 25 31 12 32 17 33 29 34 10 35 5 36 2 37 18 38 32 39 12 40 38 41 3 42 15 43 29 44 28 45 5 46 25 47 34 48 23 49 19 50 8 51 49 52 38 53 19 54 26 5...
output:
Yes
result:
ok single line: 'Yes'
Test #80:
score: -11
Time Limit Exceeded
input:
1 120000 11991 50256 11991 84876 11991 45905 11991 51568 11991 91200 11991 42928 11991 113754 8591 11991 11991 39222 11991 41683 11991 14143 11991 39036 11991 17920 11991 31807 11991 94372 11160 11991 11991 91065 11991 40582 11991 70878 11991 41750 11991 33677 11991 108658 11991 28168 11991 39793 11...
output:
result:
Subtask #7:
score: 0
Skipped
Dependency #1:
100%
Accepted
Dependency #2:
100%
Accepted
Dependency #3:
100%
Accepted
Dependency #4:
100%
Accepted
Dependency #5:
100%
Accepted
Dependency #6:
0%