QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#765795 | #9607. 熟练 | msk_sama | 100 ✓ | 1458ms | 150608kb | C++14 | 3.0kb | 2024-11-20 15:18:16 | 2024-11-20 15:18:16 |
Judging History
answer
#include <set>
#include <map>
#include <cmath>
#include <queue>
#include <ctime>
#include <cstdio>
#include <random>
#include <vector>
#include <bitset>
#include <cassert>
#include <cstring>
#include <algorithm>
#define fi first
#define se second
#define MISAKA main
#define ll long long
#define eb emplace_back
#define pii pair<int,int>
#define rep(i,a,b) for(int i=(a);i<=(b);++i)
#define _rep(i,a,b) for(int i=(a);i>=(b);--i)
#define debug(...) fprintf(stderr,__VA_ARGS__)
#define FIO(FILE) freopen(FILE".in","r",stdin),freopen(FILE".out","w",stdout)
using namespace std;
inline int read(){
char ch=getchar();int f=1,x=0;
while(ch<'0'||ch>'9'){if(ch=='-') f=-1;ch=getchar();}
while(ch>='0'&&ch<='9'){x=(x<<3)+(x<<1)+(ch^48);ch=getchar();}
return x*f;
}
const int N=5e5+10,mod=998244353;
int n,m,dfn[N],id[N],d[N],dep[N],top[N],fa[N],son[N],now[N],siz[N],cl[N],tim;
vector<int> g[N];
struct node{int x,y,id;
node(int a=0,int b=0,int c=0){x=a,y=b,id=c;}
};vector<node> vt[N];
void dfs1(int u,int f){
fa[u]=f,dep[u]=dep[f]+1,siz[u]=1;
for(int v:g[u])if(v!=f){
dfs1(v,u),siz[u]+=siz[v];
if(siz[v]>siz[son[u]]) son[u]=v;
}
}
void dfs2(int u,int tp){
top[u]=tp,id[dfn[u]=++tim]=u;
if(son[u]) dfs2(son[u],tp);
for(int v:g[u])if(v!=son[u]&&v!=fa[u]) dfs2(v,v);
}
int lca(int x,int y){
for(;top[x]^top[y];x=fa[top[x]])
if(dep[top[x]]<dep[top[y]]) swap(x,y);
return dep[x]<dep[y]?x:y;
}
void dfs3(int u){for(int v:g[u])if(v!=fa[u]) dfs3(v),d[u]+=d[v];}
struct segtree{int l,r,t;pii v;}t[N<<2];
void pu(int x){t[x].v=max(t[2*x].v,t[2*x+1].v);}
void bd(int x,int l,int r){
t[x].l=l,t[x].r=r,t[x].t=0;int mid=l+r>>1;
if(l==r){t[x].v={d[id[l]],-l};return;}
bd(2*x,l,mid);bd(2*x+1,mid+1,r);pu(x);
}
void cal(int x,int k){t[x].v.fi+=k,t[x].t+=k;}
void pd(int x){if(t[x].t)cal(2*x,t[x].t),cal(2*x+1,t[x].t),t[x].t=0;}
void upd(int x,int l,int r,int k){
if(t[x].r<l||t[x].l>r) return;
if(l<=t[x].l&&t[x].r<=r) return cal(x,k);
pd(x);upd(2*x,l,r,k);upd(2*x+1,l,r,k);pu(x);
}
void upd(int x,int y,int k){
for(;top[x]^top[y];x=fa[top[x]]){
if(dep[top[x]]<dep[top[y]]) swap(x,y);
upd(1,dfn[top[x]],dfn[x],k);
}
if(dfn[x]>dfn[y]) swap(x,y);
upd(1,dfn[x],dfn[y],k);
}
void misaka(){
rep(i,1,n) g[i].clear(),vt[i].clear(),now[i]=d[i]=dfn[i]=id[i]=siz[i]=son[i]=fa[i]=dep[i]=top[i]=cl[i]=0;tim=0;
n=read(),m=read();
rep(i,2,n){
int u=read(),v=read();
g[u].eb(v);g[v].eb(u);
}
dfs1(1,0);dfs2(1,1);
rep(i,1,m){
int u=read(),v=read(),l=lca(u,v);
vt[l].eb(u,v,i);
d[u]++,d[v]++,d[l]--,d[fa[l]]--;
}
dfs3(1);bd(1,1,n);
printf("%d\n",t[1].v.fi);
while(t[1].v.fi){
int x=id[-t[1].v.se];
node k=vt[x][now[x]++];
cl[k.id]=t[1].v.fi;
upd(k.x,k.y,-1);
}
rep(i,1,m) printf("%d ",cl[i]);puts("");
}
signed MISAKA(){
read();int T=read();
while(T--) misaka();
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Subtask #1:
score: 3
Accepted
Test #1:
score: 3
Accepted
time: 59ms
memory: 78684kb
input:
1 100000 1 2 1 1 1 1 3 5 1 2 2 3 2 1 2 3 1 1 1 1 3 3 1 3 1 1 1 1 1 1 4 4 1 2 2 3 3 4 3 3 2 1 3 3 4 2 5 3 1 2 1 3 1 4 2 5 1 1 3 3 3 1 1 5 1 1 1 1 1 1 1 1 1 1 2 5 1 2 2 1 1 2 1 2 1 2 1 2 2 2 1 2 2 2 2 2 4 2 1 2 1 3 1 4 4 4 2 3 2 3 1 2 1 2 1 1 1 1 1 4 1 1 1 1 1 1 1 1 5 3 1 2 2 3 3 4 4 5 3 4 4 5 5 2 2 1...
output:
2 2 1 3 3 1 2 1 2 3 3 2 1 3 3 1 1 2 2 2 2 1 5 5 4 3 2 1 5 5 4 3 2 1 2 2 1 1 1 1 3 3 2 1 4 4 3 2 1 3 2 3 1 1 1 2 2 1 4 4 3 2 1 3 3 2 1 1 3 3 2 1 1 1 1 2 2 1 2 2 1 4 4 3 2 1 3 3 2 1 2 4 4 3 2 1 2 1 1 4 4 3 2 1 1 1 5 5 4 3 2 1 1 1 1 5 5 4 3 2 1 2 2 1 2 3 2 1 2 3 3 3 2 1 ...
result:
ok ok
Subtask #2:
score: 14
Accepted
Dependency #1:
100%
Accepted
Test #2:
score: 14
Accepted
time: 64ms
memory: 100992kb
input:
2 1005 489417 5 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 24 49 25 50 25 51 26 52 26 5...
output:
4 3 4 1 2 1 4 4 2 3 2 1 3 3 3 1 2 1 3 3 1 2 2 1 4 4 3 2 1 3 3 2 1 1 1 4 4 3 2 1 3 2 2 1 3 1 4 4 1 2 3 4 4 3 2 2 1 3 2 1 1 3 4 4 3 2 1 5 4 3 5 2 1 3 3 2 1 1 2 5 5 4 3 2 1 5 4 3 5 2 1 4 3 4 2 1 3 2 3 1 1 4 4 3 2 1 4 2 4 3 1 4 3 4 2 1 2 5 5 3 2 1 4 3 1 1 2 3 2 2 2 2 1 1 5 4 5 3 ...
result:
ok ok
Test #3:
score: 14
Accepted
time: 175ms
memory: 114000kb
input:
2 9250 403459 5 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 5...
output:
5 1 2 4 3 5 4 2 4 3 2 1 4 4 3 2 1 4 4 3 2 1 2 2 2 1 1 4 3 4 2 1 5 5 4 3 2 1 3 3 2 2 1 1 2 1 1 1 2 4 3 2 1 4 2 2 1 1 1 4 2 4 1 1 3 3 1 1 1 3 2 4 3 1 2 4 3 3 1 2 2 2 2 2 2 1 1 1 4 4 3 2 1 2 3 3 2 3 1 4 2 3 4 1 3 1 3 3 2 1 3 2 3 2 1 5 2 1 3 5 4 4 3 4 3 2 1 2 2 2 1 1 4 4 3 3 2 1 ...
result:
ok ok
Test #4:
score: 14
Accepted
time: 86ms
memory: 90428kb
input:
2 120 55394 5 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 ...
output:
3 3 3 1 2 1 2 1 2 1 2 1 4 1 2 4 1 3 4 4 1 3 2 1 4 4 2 1 1 3 3 2 1 3 1 2 5 5 4 3 2 1 4 4 3 2 1 3 2 3 1 1 3 3 2 1 1 2 1 2 1 1 3 3 3 1 2 2 5 4 3 2 1 5 5 5 4 3 2 1 4 4 3 2 1 3 2 1 3 1 3 3 2 2 1 3 2 1 1 3 4 4 3 2 1 1 5 5 4 3 2 1 4 4 3 2 2 1 3 3 1 2 2 1 3 2 1 3 1 5 5 4 3 2 1 4 4 3 ...
result:
ok ok
Test #5:
score: 14
Accepted
time: 202ms
memory: 89108kb
input:
2 6024 82100 5 1 2 1 3 1 4 1 5 1 6 1 7 1 8 1 9 1 10 1 11 1 12 5 13 10 14 8 15 6 16 15 17 3 18 9 19 14 20 19 21 4 22 1 23 22 24 21 25 25 26 11 27 18 28 23 29 7 30 26 31 12 32 2 33 29 34 17 35 34 36 31 37 32 38 13 39 30 40 36 41 33 42 41 43 40 44 16 45 42 46 39 47 20 48 48 49 43 50 46 51 37 52 52 53 4...
output:
5 5 4 3 2 1 4 3 4 1 2 1 4 4 2 1 1 3 4 4 1 3 2 1 4 4 3 2 3 1 3 3 1 2 1 3 3 1 2 1 3 2 3 1 2 5 5 4 3 2 1 3 1 3 1 2 4 2 3 4 1 3 2 3 2 1 3 1 3 3 2 3 3 2 1 3 2 4 2 4 3 2 1 4 3 2 4 3 1 4 2 1 4 3 2 2 1 1 1 5 5 2 1 4 3 3 3 2 2 1 1 5 3 4 2 5 1 4 1 4 2 3 5 5 1 4 2 3 3 3 2 1 2 4 4 2 1 3 ...
result:
ok ok
Test #6:
score: 14
Accepted
time: 30ms
memory: 79860kb
input:
2 483 2200 5 1 2 2 3 1 4 4 5 2 6 2 7 1 8 5 9 7 10 5 11 8 12 3 13 2 14 2 15 1 16 9 17 5 18 6 19 7 20 2 21 3 22 7 23 9 24 11 25 3 26 10 27 11 28 7 29 3 30 3 31 7 32 12 33 1 34 8 35 1 36 8 37 11 38 11 39 3 40 11 41 3 42 10 43 11 44 7 45 9 46 7 47 8 48 7 49 5 50 8 51 9 52 4 53 8 54 11 55 2 56 2 57 8 58 ...
output:
4 4 3 1 2 1 2 2 1 1 1 2 2 1 1 1 2 2 4 2 4 2 3 1 4 4 2 3 2 1 3 1 3 2 1 2 5 5 4 3 2 1 4 1 2 2 4 3 4 1 3 4 2 1 4 4 2 3 1 2 5 5 4 3 2 1 5 2 3 1 5 4 4 3 4 2 2 1 3 1 2 3 1 1 3 3 2 1 1 1 2 1 2 2 1 2 2 1 1 1 2 1 3 1 2 1 1 3 3 3 2 2 1 2 5 5 4 3 2 1 5 4 3 5 2 1 4 4 3 2 2 1 3 2 3 1 3 2 3...
result:
ok ok
Test #7:
score: 14
Accepted
time: 40ms
memory: 78620kb
input:
2 400 2260 5 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 5...
output:
3 1 3 2 3 2 4 4 1 3 2 1 5 5 4 3 2 1 4 3 1 2 4 1 3 1 1 3 2 1 5 5 4 3 2 1 4 3 2 1 3 4 4 4 3 2 1 1 5 5 4 3 2 1 4 2 4 3 2 1 5 4 3 2 5 1 5 5 4 3 2 1 4 4 1 3 2 1 4 4 3 2 1 1 3 3 2 2 1 1 3 2 1 3 3 2 3 3 2 3 1 1 5 4 3 2 1 5 5 5 4 2 1 3 5 5 4 3 2 1 3 2 1 1 3 2 4 4 3 2 1 1 3 3 1 2 1 1 5...
result:
ok ok
Test #8:
score: 14
Accepted
time: 117ms
memory: 93136kb
input:
2 9990 124660 5 1 2 2 3 1 4 4 5 4 6 1 7 6 8 7 9 8 10 1 11 7 12 6 13 8 14 11 15 5 16 12 17 6 18 9 19 17 20 13 21 21 22 20 23 15 24 16 25 10 26 7 27 6 28 1 29 8 30 26 31 17 32 13 33 18 34 13 35 9 36 18 37 28 38 18 39 34 40 10 41 30 42 9 43 17 44 37 45 5 46 26 47 15 48 6 49 28 50 19 51 15 52 45 53 36 5...
output:
4 4 3 2 1 1 4 3 4 2 2 1 5 3 5 2 4 1 5 4 1 3 2 5 4 4 3 2 1 4 4 3 2 1 1 5 5 4 3 2 1 4 4 2 3 2 1 4 4 1 3 2 1 4 4 3 3 2 1 4 1 4 2 3 2 2 1 1 2 1 3 2 3 2 1 1 4 4 3 2 1 3 3 1 2 3 1 3 1 3 2 1 3 2 3 1 1 1 4 3 2 2 1 4 5 4 3 2 5 1 3 2 3 1 1 3 3 3 1 1 2 4 4 2 3 2 1 4 4 3 2 1 4 1 4 3 2 1 ...
result:
ok ok
Test #9:
score: 14
Accepted
time: 108ms
memory: 89424kb
input:
2 9078 76509 5 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...
output:
3 2 3 3 1 1 4 4 1 2 3 1 4 4 2 1 1 3 5 5 4 3 2 1 3 3 2 1 2 5 4 5 3 2 1 4 2 4 3 1 4 3 1 4 2 1 4 1 4 2 1 3 2 2 2 1 1 4 4 2 2 3 1 4 2 4 3 1 5 5 4 3 2 1 4 4 3 2 1 4 4 3 2 1 5 4 3 5 2 1 5 5 4 2 3 1 3 1 2 1 1 3 4 1 4 2 3 1 3 3 2 1 2 1 4 4 3 1 2 5 3 5 4 2 1 3 1 3 2 1 1 3 3 3 2 2 1 4 ...
result:
ok ok
Test #10:
score: 14
Accepted
time: 183ms
memory: 101952kb
input:
2 4147 456368 5 1 2 1 3 1 4 1 5 1 6 1 7 1 8 1 9 1 10 1 11 6 12 3 13 11 14 5 15 14 16 15 17 13 18 10 19 17 20 2 21 12 22 20 23 9 24 22 25 19 26 25 27 26 28 4 29 8 30 24 31 1 32 16 33 31 34 29 35 34 36 27 37 33 38 38 39 28 40 35 41 18 42 41 43 39 44 7 45 44 46 40 47 37 48 21 49 36 50 46 51 45 52 32 53...
output:
5 5 4 3 2 1 5 4 5 3 2 1 4 4 1 2 3 2 3 3 2 1 3 4 1 1 4 3 2 3 3 2 1 1 4 4 3 2 2 1 4 2 1 4 3 5 2 5 1 4 3 4 2 4 1 3 4 4 3 2 1 5 3 4 2 5 1 3 2 2 3 2 1 5 3 5 2 4 1 3 2 3 2 1 2 2 1 1 2 3 2 3 1 3 3 3 2 3 1 1 4 4 3 2 1 5 5 4 3 2 1 3 2 1 3 2 4 4 2 3 1 2 4 4 3 2 1 5 3 5 4 2 1 3 1 1 3 2 ...
result:
ok ok
Subtask #3:
score: 9
Accepted
Test #11:
score: 9
Accepted
time: 387ms
memory: 147780kb
input:
3 1769 481318 428631 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...
output:
66 6 15 16 53 19 30 44 11 24 5 39 19 9 38 35 33 23 18 45 15 47 4 48 23 52 55 29 34 49 41 50 9 40 36 25 8 21 3 15 37 31 26 43 25 7 50 21 12 7 28 14 30 12 7 36 46 57 5 1 10 20 2 15 17 2 40 10 29 37 22 36 3 16 32 38 53 4 11 25 1 20 47 45 27 18 23 42 6 6 11 31 10 10 13 51 1 29 9 40 24 22 14 54 2 8 1 19 ...
result:
ok ok
Test #12:
score: 9
Accepted
time: 320ms
memory: 98376kb
input:
3 5246 78503 54670 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 5...
output:
12758 11230 3382 340 8532 7680 6346 2609 11 10253 5101 6270 2174 3081 9110 8090 8644 53 8273 10282 6613 10107 5848 10978 6731 3389 1133 2589 12619 869 8189 3100 5951 2999 2684 11846 2106 318 4469 5697 7121 9529 760 6356 10056 12446 8997 476 2312 6314 1458 7055 12271 6802 12570 8688 7280 11262 9191 2...
result:
ok ok
Test #13:
score: 9
Accepted
time: 192ms
memory: 79112kb
input:
3 396 1125 1442 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 5...
output:
160 59 75 117 12 24 141 74 39 95 83 98 50 10 67 122 128 88 94 3 81 157 28 22 44 88 76 9 45 130 77 46 6 105 68 69 105 27 35 57 39 78 36 21 92 38 9 69 61 144 21 2 18 32 49 76 57 26 35 121 59 60 152 63 125 8 111 1 71 7 56 116 34 104 37 148 15 25 11 91 52 120 98 123 53 109 19 14 73 8 126 93 5 11 10 18 4...
result:
ok ok
Test #14:
score: 9
Accepted
time: 192ms
memory: 80956kb
input:
3 487 1664 2238 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 5...
output:
558 148 504 458 218 205 412 149 204 44 377 494 289 235 294 179 224 325 381 265 180 94 297 544 47 493 201 268 469 286 289 395 4 73 71 296 384 527 388 20 442 129 263 352 94 333 168 355 316 94 350 47 429 309 95 323 394 34 249 202 185 143 71 103 333 91 208 489 468 70 422 109 409 474 7 533 11 506 477 142...
result:
ok ok
Test #15:
score: 9
Accepted
time: 719ms
memory: 150608kb
input:
3 130 498610 459330 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 ...
output:
28970 4321 8171 64 18793 2819 24535 8033 6741 13790 4680 19325 13499 17992 1886 23654 16739 13425 27882 22090 11240 16372 3771 14456 4148 13340 7410 12025 9064 7108 2388 11289 1372 25393 19716 13580 13966 940 15782 10919 13323 17278 14519 3606 24537 21421 2000 25864 22902 19220 15402 12981 3011 5140...
result:
ok ok
Test #16:
score: 9
Accepted
time: 578ms
memory: 145784kb
input:
3 3566 462541 448340 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...
output:
183 2 32 35 117 94 102 56 67 107 22 104 151 127 84 62 116 101 23 10 22 53 85 41 74 15 125 27 78 75 117 10 52 16 152 3 28 133 49 140 84 57 121 102 42 19 4 88 51 90 16 115 116 131 127 17 14 108 81 24 6 118 91 37 22 95 11 43 77 1 103 15 48 11 105 27 144 55 8 77 21 94 89 59 38 158 85 79 92 22 48 5 125 8...
result:
ok ok
Subtask #4:
score: 20
Accepted
Test #17:
score: 20
Accepted
time: 4ms
memory: 80544kb
input:
4 37 923 917 1 2 1 3 1 4 1 5 1 6 1 7 1 8 1 9 1 10 1 11 1 12 10 13 4 14 11 15 9 16 8 17 5 18 18 19 2 20 13 21 12 22 14 23 19 24 3 25 16 26 15 27 22 28 28 29 21 30 6 31 31 32 23 33 1 34 17 35 30 36 26 37 37 38 34 39 20 40 40 41 39 42 41 43 38 44 24 45 33 46 42 47 25 48 45 49 29 50 36 51 48 52 43 53 51...
output:
839 1 839 838 6 837 836 835 834 833 832 3 831 830 829 828 827 826 825 824 823 822 6 821 820 1 819 818 817 816 2 815 814 813 812 4 811 1 810 3 809 808 807 806 805 804 803 802 5 801 800 799 798 797 796 795 794 793 8 792 791 790 789 788 787 786 785 1 784 783 3 782 781 780 779 778 777 776 775 774 773 77...
result:
ok ok
Test #18:
score: 20
Accepted
time: 11ms
memory: 78296kb
input:
4 26 910 955 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 5...
output:
417 167 385 238 397 309 69 56 300 94 130 129 192 283 335 59 204 121 143 411 185 384 325 166 371 351 262 142 181 321 12 261 38 203 333 320 326 212 371 202 209 331 117 77 258 16 303 293 33 29 251 64 393 34 249 41 294 152 245 224 412 205 103 407 100 113 224 1 280 32 36 354 71 29 6 398 54 362 180 318 16...
result:
ok ok
Test #19:
score: 20
Accepted
time: 10ms
memory: 78972kb
input:
4 27 932 945 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 24 49 25 50 25 51 26 52 26 53 2...
output:
161 15 14 13 134 153 12 134 148 126 18 133 133 21 16 132 156 11 132 1 131 130 4 129 152 131 128 126 125 161 127 124 126 125 151 23 11 124 123 18 147 160 122 155 146 123 9 14 43 125 130 129 10 151 121 24 145 128 22 19 120 122 124 123 122 121 121 13 15 147 150 120 127 6 1 119 119 120 2 118 117 126 116...
result:
ok ok
Test #20:
score: 20
Accepted
time: 14ms
memory: 79004kb
input:
4 27 915 930 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 5...
output:
473 271 35 218 234 297 333 260 414 217 298 289 24 470 312 53 294 309 356 419 466 163 219 239 274 382 280 71 341 305 445 336 182 275 108 376 17 159 122 63 43 383 332 216 234 238 255 167 324 145 78 184 281 126 472 9 101 198 28 27 226 3 252 227 198 98 363 317 238 215 257 351 16 126 379 403 426 214 181 ...
result:
ok ok
Test #21:
score: 20
Accepted
time: 9ms
memory: 79572kb
input:
4 20 966 940 1 2 2 3 1 4 4 5 5 6 2 7 2 8 6 9 2 10 10 11 3 12 4 13 6 14 11 15 2 16 1 17 13 18 15 19 16 20 16 21 20 22 5 23 6 24 18 25 21 26 18 27 18 28 7 29 25 30 29 31 21 32 3 33 4 34 32 35 16 36 14 37 15 38 16 39 17 40 4 41 7 42 22 43 1 44 33 45 31 46 37 47 15 48 5 49 30 50 43 51 16 52 47 53 13 54 ...
output:
196 196 141 195 194 140 193 139 138 137 136 192 146 135 191 190 145 15 134 133 189 188 132 4 131 187 130 129 27 128 186 185 127 8 126 125 124 123 122 10 121 120 26 119 6 184 118 183 117 182 116 115 114 181 2 113 25 112 111 180 179 110 13 109 178 144 108 107 106 105 3 177 176 143 104 103 142 102 101 ...
result:
ok ok
Test #22:
score: 20
Accepted
time: 13ms
memory: 80572kb
input:
4 28 920 959 1 2 2 3 1 4 3 5 2 6 4 7 6 8 3 9 4 10 6 11 11 12 8 13 3 14 4 15 8 16 13 17 3 18 17 19 11 20 14 21 7 22 19 23 7 24 12 25 3 26 12 27 22 28 9 29 15 30 17 31 14 32 8 33 2 34 7 35 12 36 13 37 22 38 25 39 20 40 37 41 11 42 29 43 17 44 23 45 36 46 7 47 27 48 24 49 30 50 28 51 17 52 26 53 46 54 ...
output:
216 124 216 123 158 215 122 68 95 151 150 90 121 149 120 119 118 148 117 116 115 114 113 112 111 214 147 5 146 46 110 213 37 212 145 144 109 2 86 34 108 107 188 187 143 157 186 106 8 142 141 105 57 104 33 1 103 32 211 102 156 101 100 99 98 31 97 140 96 155 154 139 95 94 93 92 91 90 89 88 87 86 85 13...
result:
ok ok
Test #23:
score: 20
Accepted
time: 8ms
memory: 78928kb
input:
4 24 935 984 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 5...
output:
175 93 10 32 43 12 26 14 44 50 3 44 82 61 168 118 107 4 114 130 55 79 2 28 67 123 45 42 91 17 114 72 3 125 1 66 22 127 118 171 105 128 148 53 69 147 156 86 8 76 101 108 120 83 30 17 10 154 104 88 58 106 2 150 52 59 65 70 78 153 132 140 110 10 115 159 18 113 80 39 50 4 16 129 82 3 100 137 13 103 90 5...
result:
ok ok
Test #24:
score: 20
Accepted
time: 7ms
memory: 78072kb
input:
4 31 919 917 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 24 49 25 50 25 51 26 52 26 53 2...
output:
588 588 564 563 562 587 561 466 465 464 1 463 462 461 586 460 45 459 56 560 458 457 559 456 455 454 453 558 452 451 44 585 450 584 583 449 448 582 557 447 446 53 51 36 445 444 443 442 581 63 441 440 439 438 437 436 435 580 434 579 1 62 578 433 577 576 432 556 50 431 575 430 429 428 574 427 426 425 4...
result:
ok ok
Test #25:
score: 20
Accepted
time: 8ms
memory: 79412kb
input:
4 22 986 926 1 2 2 3 1 4 2 5 4 6 6 7 3 8 5 9 7 10 4 11 3 12 4 13 7 14 5 15 3 16 8 17 1 18 8 19 3 20 1 21 5 22 2 23 4 24 8 25 4 26 3 27 2 28 1 29 4 30 2 31 2 32 5 33 3 34 6 35 5 36 5 37 6 38 1 39 8 40 5 41 6 42 3 43 8 44 1 45 8 46 6 47 8 48 4 49 6 50 3 51 8 52 7 53 4 54 5 55 6 56 5 57 4 58 8 59 2 60 ...
output:
123 114 116 123 113 115 114 112 112 117 116 113 113 112 111 111 122 111 110 121 110 120 119 112 115 110 114 109 118 109 114 109 113 111 110 113 108 108 108 117 112 116 107 113 115 107 106 106 109 112 107 105 106 108 114 113 107 112 112 105 111 106 111 111 105 110 110 110 109 111 104 104 110 103 109 ...
result:
ok ok
Test #26:
score: 20
Accepted
time: 12ms
memory: 78024kb
input:
4 22 931 950 1 2 1 3 2 4 3 5 3 6 2 7 6 8 3 9 7 10 7 11 8 12 5 13 3 14 4 15 2 16 3 17 8 18 1 19 3 20 5 21 5 22 6 23 8 24 3 25 1 26 8 27 8 28 8 29 5 30 6 31 4 32 6 33 3 34 8 35 6 36 6 37 7 38 2 39 3 40 8 41 8 42 3 43 8 44 5 45 6 46 7 47 2 48 2 49 1 50 4 51 7 52 7 53 6 54 3 55 3 56 5 57 1 58 5 59 7 60 ...
output:
648 579 411 578 577 576 575 648 15 43 574 573 572 403 571 647 570 569 402 568 646 567 566 565 564 79 645 41 563 562 561 400 560 559 77 51 558 557 397 556 555 554 553 552 551 550 549 548 547 546 545 40 544 394 47 543 542 393 541 644 540 76 392 539 538 537 39 536 535 643 534 37 642 533 389 39 384 532 ...
result:
ok ok
Test #27:
score: 20
Accepted
time: 11ms
memory: 79692kb
input:
4 24 990 970 1 2 2 3 3 4 4 5 4 6 3 7 5 8 6 9 2 10 2 11 5 12 3 13 4 14 6 15 9 16 7 17 3 18 17 19 10 20 7 21 12 22 2 23 13 24 23 25 20 26 26 27 20 28 11 29 16 30 16 31 16 32 1 33 31 34 26 35 24 36 24 37 13 38 12 39 15 40 29 41 33 42 21 43 6 44 44 45 10 46 29 47 24 48 24 49 30 50 6 51 12 52 21 53 26 54...
output:
675 225 20 675 674 424 423 673 672 671 670 422 238 224 669 2 668 20 667 666 421 420 237 419 418 222 19 220 87 417 416 415 665 414 664 413 412 411 663 662 410 219 661 660 409 408 659 9 407 406 658 405 404 403 657 656 211 5 655 654 402 653 210 401 400 399 398 397 209 86 233 396 652 85 84 395 651 394 3...
result:
ok ok
Test #28:
score: 20
Accepted
time: 4ms
memory: 80472kb
input:
4 22 971 961 1 2 2 3 1 4 3 5 4 6 6 7 2 8 3 9 2 10 10 11 8 12 11 13 11 14 9 15 9 16 8 17 8 18 10 19 10 20 20 21 13 22 10 23 12 24 12 25 23 26 4 27 18 28 23 29 4 30 5 31 19 32 7 33 20 34 7 35 4 36 36 37 28 38 14 39 15 40 14 41 34 42 19 43 33 44 3 45 33 46 35 47 31 48 9 49 42 50 8 51 36 52 27 53 44 54 ...
output:
377 377 376 242 76 56 241 240 375 239 108 73 374 238 107 36 373 106 237 236 235 234 53 233 232 231 46 230 372 229 371 7 228 259 227 226 225 224 6 103 223 370 222 221 220 219 218 217 67 216 5 369 368 100 367 98 215 214 213 366 365 258 212 364 363 257 211 1 210 362 361 1 360 209 359 358 357 95 208 207...
result:
ok ok
Test #29:
score: 20
Accepted
time: 16ms
memory: 79968kb
input:
4 25 994 999 1 2 1 3 1 4 1 5 1 6 1 7 1 8 8 9 3 10 7 11 9 12 1 13 12 14 11 15 15 16 5 17 16 18 13 19 6 20 4 21 17 22 19 23 2 24 10 25 23 26 20 27 24 28 27 29 18 30 22 31 31 32 32 33 14 34 34 35 26 36 36 37 29 38 21 39 30 40 39 41 28 42 35 43 41 44 25 45 33 46 44 47 42 48 38 49 40 50 50 51 46 52 45 53...
output:
261 7 261 260 259 258 257 256 255 254 253 38 252 251 250 249 248 247 246 245 244 243 242 241 2 240 239 31 238 23 237 236 235 234 233 232 231 230 229 228 227 226 225 224 223 222 221 220 219 218 217 216 215 214 213 212 211 210 209 208 6 5 207 206 205 204 203 11 202 201 200 199 198 197 196 195 4 194 19...
result:
ok ok
Test #30:
score: 20
Accepted
time: 7ms
memory: 79756kb
input:
4 31 943 994 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 5...
output:
34 12 1 18 11 3 6 11 1 16 12 26 16 26 1 23 22 18 24 23 5 7 8 28 9 15 23 14 20 10 2 3 10 13 8 5 21 10 8 25 14 11 18 7 17 28 32 11 16 14 26 7 23 25 15 22 9 7 15 1 25 25 28 8 19 2 31 29 10 13 14 31 20 2 16 10 21 8 10 6 23 9 4 13 32 15 20 25 1 18 7 16 8 5 2 3 8 12 13 5 21 1 12 4 19 1 10 9 24 22 3 8 15 2...
result:
ok ok
Test #31:
score: 20
Accepted
time: 4ms
memory: 79620kb
input:
4 27 981 972 1 2 1 3 2 4 3 5 5 6 6 7 7 8 1 9 9 10 4 11 11 12 8 13 13 14 14 15 15 16 12 17 16 18 17 19 10 20 20 21 19 22 18 23 21 24 22 25 25 26 23 27 24 28 27 29 29 30 30 31 31 32 28 33 32 34 33 35 35 36 26 37 34 38 38 39 39 40 36 41 41 42 40 43 42 44 37 45 43 46 46 47 44 48 45 49 49 50 50 51 47 52 ...
output:
19 14 13 12 11 10 9 8 7 18 4 4 1 2 12 4 7 4 9 6 7 9 7 2 5 9 5 3 4 3 5 5 7 8 4 6 6 9 3 5 6 14 6 3 5 1 9 2 10 6 1 5 3 2 3 6 10 4 6 2 9 1 9 9 11 5 7 9 2 6 1 2 7 3 6 16 6 14 4 5 8 5 9 4 1 5 2 18 8 4 6 4 7 6 5 9 8 2 6 8 1 16 6 1 10 3 7 4 4 5 10 2 1 5 3 8 7 6 1 3 1 1 8 2 4 15 7 1 5 3 3 19 6 5 17 2 3 4 6 1...
result:
ok ok
Test #32:
score: 20
Accepted
time: 4ms
memory: 79256kb
input:
4 27 941 912 1 2 1 3 2 4 3 5 1 6 5 7 1 8 8 9 6 10 1 11 2 12 10 13 3 14 12 15 7 16 1 17 13 18 12 19 6 20 13 21 14 22 16 23 1 24 11 25 16 26 9 27 4 28 1 29 2 30 2 31 4 32 14 33 7 34 7 35 5 36 7 37 7 38 15 39 1 40 5 41 5 42 11 43 7 44 15 45 17 46 3 47 11 48 5 49 13 50 4 51 14 52 6 53 6 54 8 55 2 56 1 5...
output:
150 36 150 18 149 117 148 7 147 116 115 102 105 146 101 104 145 90 144 34 114 148 100 113 103 147 112 143 111 142 100 141 110 61 99 140 146 102 89 139 113 55 145 109 30 138 101 1 60 60 1 108 88 25 99 144 143 98 97 17 142 100 99 56 98 96 95 6 137 97 107 141 96 112 27 140 139 54 87 106 46 138 105 136 ...
result:
ok ok
Subtask #5:
score: 22
Accepted
Dependency #4:
100%
Accepted
Test #33:
score: 22
Accepted
time: 166ms
memory: 85840kb
input:
5 496 94286 94269 1 2 1 3 1 4 1 5 1 6 1 7 1 8 1 9 1 10 1 11 9 12 4 13 3 14 13 15 1 16 5 17 16 18 15 19 18 20 2 21 10 22 12 23 23 24 14 25 19 26 20 27 26 28 8 29 29 30 27 31 21 32 25 33 28 34 22 35 30 36 17 37 32 38 33 39 7 40 38 41 37 42 39 43 11 44 44 45 35 46 40 47 41 48 43 49 24 50 34 51 45 52 47...
output:
27238 27238 27237 27236 27235 46 53 27234 117 27233 27232 27231 27230 27229 27228 27227 27226 27225 27224 27223 166 27222 27221 27220 27219 27218 27217 27216 27215 27214 27213 27212 27211 27210 27209 27208 27207 27206 27205 27204 27203 27202 27201 27200 49 27199 27198 95 27197 27196 27195 27194 2719...
result:
ok ok
Test #34:
score: 22
Accepted
time: 270ms
memory: 84980kb
input:
5 102 87302 98915 1 2 2 3 3 4 4 5 1 6 2 7 3 8 1 9 7 10 3 11 9 12 5 13 2 14 13 15 3 16 9 17 7 18 13 19 19 20 16 21 4 22 20 23 14 24 18 25 17 26 26 27 7 28 4 29 3 30 28 31 16 32 32 33 5 34 13 35 17 36 10 37 19 38 14 39 22 40 22 41 36 42 25 43 43 44 12 45 6 46 33 47 24 48 38 49 8 50 31 51 26 52 47 53 2...
output:
43611 18844 26835 26834 26833 43611 43610 26832 43609 26831 299 43608 43607 26830 43606 23243 11479 43605 43604 43603 26829 43602 18843 26828 18842 43601 18841 26827 43600 285 43599 43598 26826 18840 26825 43597 18838 43596 18837 26824 43595 26823 23242 43594 43593 18835 18834 26822 26821 43592 2324...
result:
ok ok
Test #35:
score: 22
Accepted
time: 396ms
memory: 85660kb
input:
5 465 95072 88256 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 24 49 25 50 25 51 26 52 26...
output:
58693 39856 45061 39855 39854 45060 58693 45059 8128 39853 39852 58692 39851 39850 39849 58691 58690 39848 39847 39846 4856 39845 3062 11001 4855 58689 39844 39843 39842 45058 58688 39841 39840 39839 39838 39837 8127 8126 39836 78 10999 58687 58686 58685 39835 39834 39833 247 39832 58684 39831 45057...
result:
ok ok
Test #36:
score: 22
Accepted
time: 75ms
memory: 81372kb
input:
5 911 9670 12225 1 2 1 3 1 4 1 5 1 6 1 7 1 8 1 9 1 10 8 11 6 12 5 13 4 14 7 15 9 16 16 17 11 18 1 19 14 20 15 21 13 22 3 23 20 24 12 25 24 26 26 27 23 28 18 29 27 30 22 31 2 32 19 33 32 34 25 35 34 36 29 37 10 38 28 39 33 40 30 41 38 42 17 43 41 44 36 45 37 46 45 47 40 48 44 49 48 50 50 51 51 52 49 ...
output:
11000 11000 10999 10998 10997 47 10996 10995 7 10994 10993 10992 10991 10990 10989 26 10988 10987 11 10986 17 10985 10984 10983 10982 10981 10980 10979 10978 10977 10976 10975 45 10974 10973 4 10972 10971 10970 10969 68 10968 10967 10966 10965 10964 10963 10962 10961 10960 10959 10958 10957 10956 10...
result:
ok ok
Test #37:
score: 22
Accepted
time: 72ms
memory: 80572kb
input:
5 1077 7078 10459 1 2 1 3 3 4 2 5 3 6 4 7 7 8 3 9 4 10 7 11 9 12 1 13 2 14 8 15 6 16 5 17 5 18 11 19 6 20 14 21 8 22 11 23 12 24 15 25 10 26 10 27 7 28 2 29 7 30 1 31 14 32 7 33 1 34 13 35 11 36 5 37 11 38 8 39 3 40 14 41 3 42 7 43 14 44 6 45 11 46 8 47 13 48 9 49 6 50 4 51 10 52 2 53 12 54 14 55 10...
output:
3386 2433 2432 3386 2431 2430 2429 2428 3385 2427 2426 3384 3383 3382 3381 907 2425 2424 1087 2423 3380 2422 3379 2421 2420 717 3378 1085 2419 3377 2418 2417 2416 508 3376 2415 3375 3374 2414 2413 2412 3373 716 2411 2410 2409 2408 1082 3372 2407 2406 2405 1079 2404 2403 3371 3370 2402 2401 2400 3369...
result:
ok ok
Test #38:
score: 22
Accepted
time: 93ms
memory: 81668kb
input:
5 942 12731 14938 1 2 2 3 3 4 3 5 2 6 1 7 2 8 4 9 4 10 7 11 7 12 4 13 8 14 6 15 4 16 2 17 10 18 4 19 9 20 3 21 17 22 14 23 6 24 20 25 2 26 3 27 22 28 7 29 15 30 27 31 5 32 19 33 6 34 31 35 11 36 33 37 21 38 10 39 34 40 6 41 20 42 19 43 22 44 27 45 41 46 27 47 34 48 36 49 49 50 26 51 47 52 25 53 35 5...
output:
1051 1037 813 1024 930 549 901 812 548 547 811 810 809 929 546 928 808 807 806 805 1023 545 1022 804 803 900 802 1021 801 544 827 927 800 543 799 798 542 797 796 541 1020 826 540 795 1019 539 926 794 538 925 924 537 793 536 673 1036 10 121 104 332 883 923 348 1018 882 695 1017 822 303 922 764 763 76...
result:
ok ok
Test #39:
score: 22
Accepted
time: 70ms
memory: 81164kb
input:
5 147 1196 1056 1 2 2 3 2 4 3 5 3 6 5 7 3 8 2 9 3 10 10 11 2 12 3 13 12 14 4 15 4 16 3 17 6 18 6 19 10 20 3 21 9 22 8 23 2 24 2 25 6 26 1 27 4 28 3 29 1 30 11 31 8 32 5 33 5 34 7 35 3 36 9 37 1 38 9 39 6 40 4 41 7 42 5 43 4 44 12 45 2 46 8 47 5 48 8 49 6 50 9 51 11 52 5 53 6 54 2 55 9 56 8 57 10 58 ...
output:
451 190 451 406 189 26 405 450 449 404 188 448 403 447 402 446 187 401 445 400 32 399 186 398 444 397 185 396 184 395 394 443 393 442 441 440 183 392 391 439 390 389 388 387 386 438 385 384 383 182 437 382 436 181 435 25 381 380 31 434 379 433 74 180 72 179 22 432 378 377 376 375 178 177 176 175 174...
result:
ok ok
Test #40:
score: 22
Accepted
time: 85ms
memory: 79784kb
input:
5 123 1403 768 1 2 1 3 3 4 1 5 1 6 6 7 2 8 8 9 1 10 3 11 2 12 5 13 5 14 2 15 8 16 10 17 6 18 7 19 8 20 10 21 10 22 10 23 6 24 4 25 4 26 7 27 3 28 3 29 8 30 9 31 4 32 4 33 10 34 8 35 6 36 2 37 3 38 5 39 9 40 2 41 1 42 3 43 1 44 9 45 7 46 2 47 3 48 2 49 3 50 8 51 9 52 5 53 10 54 3 55 3 56 1 57 5 58 2 ...
output:
118 90 118 117 116 88 115 114 113 112 111 110 61 109 108 107 106 105 104 103 79 87 102 78 101 100 99 98 97 96 95 94 93 60 92 91 90 89 88 87 86 85 84 83 82 59 85 81 75 74 1 71 74 58 57 80 75 79 73 77 78 70 69 81 74 76 75 56 77 73 55 80 72 73 76 79 68 54 75 72 71 70 78 67 77 67 74 57 74 72 71 76 71 1 ...
result:
ok ok
Test #41:
score: 22
Accepted
time: 69ms
memory: 80148kb
input:
5 227 1768 690 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...
output:
345 323 164 169 169 80 14 132 250 115 111 187 248 152 29 120 315 131 260 85 125 273 272 129 86 55 269 260 141 266 127 26 110 305 291 143 52 230 208 157 135 298 27 276 150 172 155 225 22 230 44 217 250 22 88 244 224 131 50 84 323 57 186 181 293 200 290 134 190 145 111 198 273 43 62 229 109 4 171 194 ...
result:
ok ok
Test #42:
score: 22
Accepted
time: 68ms
memory: 80052kb
input:
5 139 2287 2214 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 24 49 25 50 25 51 26 52 26 5...
output:
695 524 674 523 522 552 60 551 695 695 550 521 549 21 673 520 3 261 519 548 518 694 547 546 545 260 88 694 544 30 88 543 693 517 672 69 671 70 693 670 68 516 83 692 515 669 542 514 541 692 513 259 540 539 691 668 690 689 667 666 512 538 537 40 691 688 43 511 536 1 535 6 687 686 17 80 534 5 533 690 5...
result:
ok ok
Test #43:
score: 22
Accepted
time: 141ms
memory: 89444kb
input:
5 85 99108 97396 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 ...
output:
48829 14993 47630 28347 17119 2450 34978 34883 12997 10827 25504 32417 40325 33340 36933 10693 38893 16194 44034 31974 9496 26769 22720 26519 32068 5839 33462 8902 5245 19242 47837 19474 7031 8959 26437 131 413 9548 18022 16993 20019 42869 40015 12972 25965 28758 47413 45027 46174 42372 26326 14104 ...
result:
ok ok
Test #44:
score: 22
Accepted
time: 121ms
memory: 85628kb
input:
5 221 97581 86531 1 2 1 3 1 4 4 5 5 6 1 7 4 8 4 9 7 10 2 11 2 12 2 13 9 14 10 15 13 16 4 17 12 18 10 19 16 20 17 21 6 22 18 23 8 24 17 25 22 26 16 27 22 28 8 29 8 30 11 31 21 32 23 33 19 34 9 35 25 36 10 37 1 38 7 39 38 40 38 41 6 42 35 43 36 44 20 45 20 46 16 47 22 48 21 49 43 50 17 51 17 52 39 53 ...
output:
126 12 22 126 125 124 123 122 21 121 120 119 118 22 117 116 115 18 114 113 112 16 1 111 110 109 30 5 108 107 106 105 104 20 103 102 101 100 99 27 98 97 96 7 95 94 93 92 10 40 91 90 19 89 15 88 87 15 86 85 84 83 82 81 12 80 79 78 77 76 11 75 74 26 37 16 73 72 71 70 69 10 68 67 66 65 64 63 62 35 22 61...
result:
ok ok
Test #45:
score: 22
Accepted
time: 136ms
memory: 85232kb
input:
5 125 98543 89905 1 2 2 3 1 4 4 5 4 6 1 7 6 8 1 9 3 10 4 11 7 12 9 13 1 14 4 15 7 16 8 17 5 18 8 19 3 20 6 21 5 22 7 23 6 24 4 25 9 26 8 27 8 28 2 29 9 30 3 31 2 32 1 33 1 34 3 35 9 36 2 37 5 38 8 39 5 40 3 41 6 42 1 43 1 44 8 45 3 46 7 47 5 48 3 49 5 50 9 51 8 52 7 53 7 54 8 55 4 56 9 57 6 58 5 59 ...
output:
10182 9935 9897 9896 9934 9895 9894 9893 9892 9891 9933 10001 9932 9931 10011 9978 9991 9963 9977 9990 9976 10010 9954 9989 9953 10182 10009 9988 9952 9890 9930 9929 9951 10181 10180 9950 9987 10008 10007 9889 10006 10179 10000 9975 9888 9887 9886 9949 9928 9948 10005 9999 9927 10178 9998 9974 10177...
result:
ok ok
Test #46:
score: 22
Accepted
time: 140ms
memory: 90128kb
input:
5 1256 83133 86248 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 5...
output:
31782 4473 1677 17189 28583 16644 24916 28186 11040 2248 17090 10728 19350 26879 12701 22262 15394 1739 3278 8980 24487 20054 24022 17357 18946 16337 24889 22121 18498 29700 17970 21910 11818 17936 13681 27520 12551 15000 21652 19963 5288 5107 3634 4728 11812 12040 24584 13844 2153 7904 1331 9289 20...
result:
ok ok
Test #47:
score: 22
Accepted
time: 76ms
memory: 81912kb
input:
5 337 8058 14070 1 2 1 3 2 4 2 5 1 6 1 7 6 8 3 9 1 10 8 11 4 12 11 13 8 14 1 15 10 16 4 17 11 18 7 19 8 20 4 21 1 22 8 23 3 24 11 25 12 26 3 27 9 28 6 29 4 30 3 31 11 32 7 33 4 34 9 35 10 36 4 37 4 38 5 39 8 40 3 41 9 42 9 43 4 44 10 45 4 46 5 47 4 48 4 49 6 50 10 51 7 52 11 53 5 54 12 55 12 56 5 57...
output:
4114 4114 4113 4112 4111 4110 4109 4108 3061 4107 4106 4105 4104 4103 3060 4102 4101 4100 3059 4099 4098 4097 2397 4096 4095 4094 4093 4092 4091 4090 1423 3147 4089 2396 4088 4087 4086 4085 3146 4084 4083 4082 4081 319 4080 496 2395 4079 4078 3145 1420 4077 4076 316 4075 4074 3058 3057 4073 4072 407...
result:
ok ok
Test #48:
score: 22
Accepted
time: 109ms
memory: 81076kb
input:
5 443 9541 12325 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 ...
output:
2862 2463 2192 563 1025 236 395 420 2398 1253 1075 18 343 259 1474 1942 924 392 2294 805 1159 439 826 571 73 383 2707 2316 996 747 1383 2092 223 625 6 914 2217 16 2834 1179 546 56 1653 1444 1027 1039 549 2307 1517 135 2108 2555 2195 336 13 1409 665 932 63 466 1659 1584 2065 2691 888 1647 1347 2606 3...
result:
ok ok
Subtask #6:
score: 32
Accepted
Dependency #1:
100%
Accepted
Dependency #2:
100%
Accepted
Dependency #3:
100%
Accepted
Dependency #4:
100%
Accepted
Dependency #5:
100%
Accepted
Test #49:
score: 32
Accepted
time: 455ms
memory: 149568kb
input:
6 178 497927 412086 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 ...
output:
120 36 7 23 14 68 24 1 82 57 59 58 20 27 106 25 77 56 8 79 1 11 88 14 33 49 47 31 91 81 18 115 5 46 69 83 95 37 71 16 92 3 47 32 10 74 25 16 89 1 61 73 25 52 53 43 28 105 2 7 2 29 107 3 22 81 13 16 3 9 72 97 11 49 58 36 64 7 41 93 63 6 73 53 59 48 15 19 6 59 66 56 34 21 93 31 83 14 70 38 75 13 54 28...
result:
ok ok
Test #50:
score: 32
Accepted
time: 644ms
memory: 145004kb
input:
6 3234 454553 464302 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...
output:
232572 31357 2235 111265 172336 45976 57160 133168 229826 146767 101895 37257 113021 216483 23767 32123 123618 59527 147321 53402 148387 105359 8418 130549 58477 3657 50309 57456 133403 59465 175159 148022 102426 76876 128294 71236 138495 186062 90513 85855 13328 7106 176579 57341 221561 109145 2091...
result:
ok ok
Test #51:
score: 32
Accepted
time: 1458ms
memory: 104816kb
input:
6 5593 417535 438611 1 2 1 3 1 4 1 5 1 6 1 7 4 8 2 9 1 10 8 11 9 12 12 13 10 14 11 15 14 16 15 17 7 18 6 19 19 20 3 21 20 22 22 23 23 24 16 25 24 26 26 27 25 28 18 29 13 30 27 31 21 32 5 33 30 34 31 35 32 36 34 37 17 38 33 39 38 40 40 41 28 42 36 43 42 44 29 45 37 46 43 47 44 48 35 49 47 50 39 51 50...
output:
347915 347915 347914 347913 347912 347911 347910 347909 4483 347908 347907 347906 347905 347904 347903 347902 347901 347900 347899 347898 347897 347896 347895 347894 347893 347892 347891 347890 258 347889 347888 347887 347886 347885 347884 347883 2606 347882 1329 347881 347880 347879 347878 347877 3...
result:
ok ok
Test #52:
score: 32
Accepted
time: 991ms
memory: 86120kb
input:
6 13826 84978 124376 1 2 2 3 3 4 4 5 3 6 1 7 4 8 8 9 7 10 7 11 3 12 5 13 12 14 10 15 6 16 14 17 9 18 15 19 8 20 13 21 12 22 20 23 16 24 23 25 4 26 5 27 2 28 5 29 5 30 17 31 5 32 24 33 11 34 14 35 11 36 25 37 22 38 16 39 11 40 29 41 38 42 17 43 38 44 41 45 17 46 44 47 33 48 42 49 6 50 29 51 51 52 3 5...
output:
80099 14450 80099 28894 28893 80098 80097 80096 28892 80095 3820 28891 80094 80093 80092 28890 796 80091 3819 80090 14449 28889 28888 28887 80089 28886 80088 14447 28885 80087 80086 14445 80085 80084 80083 80082 684 80081 80080 28884 30333 28883 80079 14443 28882 80078 80077 80076 5027 28881 80075 1...
result:
ok ok
Test #53:
score: 32
Accepted
time: 678ms
memory: 104308kb
input:
6 3480 135245 82221 1 2 1 3 1 4 1 5 1 6 4 7 3 8 5 9 2 10 6 11 1 12 11 13 13 14 14 15 8 16 10 17 12 18 16 19 7 20 19 21 18 22 20 23 15 24 23 25 24 26 26 27 17 28 22 29 29 30 9 31 31 32 21 33 33 34 25 35 30 36 27 37 37 38 38 39 39 40 36 41 40 42 35 43 34 44 42 45 32 46 43 47 47 48 44 49 45 50 28 51 50...
output:
8376 8376 8375 8374 464 3635 1824 7394 245 2730 174 3811 4925 2217 923 8373 1544 5992 5763 2056 4568 1118 4203 7800 3807 146 438 1387 14 8372 3310 3683 555 1994 7343 254 446 1394 8371 3013 5513 8370 8369 544 5126 8368 4229 299 7829 583 4675 714 919 3071 8367 5852 1898 5775 8009 5546 8284 2879 1540 4...
result:
ok ok
Test #54:
score: 32
Accepted
time: 365ms
memory: 101568kb
input:
6 6213 156426 135199 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...
output:
62086 13676 58458 61707 13889 15844 44308 46196 54886 46904 7157 61010 12841 21210 6427 172 27744 16998 58721 26464 4975 32801 25263 20949 34377 31878 15497 42568 1914 51461 22748 16826 27612 19170 41580 41277 1278 2612 45317 41927 58993 3169 10899 54633 35355 26015 25237 1042 36092 57515 8665 45642...
result:
ok ok
Test #55:
score: 32
Accepted
time: 333ms
memory: 78736kb
input:
6 394 1424 1766 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 24 49 25 50 25 51 26 52 26 5...
output:
604 7 6 604 5 559 548 482 59 442 551 481 558 603 480 89 479 441 440 439 602 601 478 477 557 476 547 475 438 474 13 473 472 471 437 470 546 469 1 545 59 544 468 556 436 435 434 467 433 432 64 3 8 2 431 55 6 430 429 466 465 543 600 464 599 428 427 18 56 463 462 461 460 11 459 426 458 555 598 425 457 5...
result:
ok ok
Test #56:
score: 32
Accepted
time: 354ms
memory: 80280kb
input:
6 400 1210 2471 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 24 49 25 50 25 51 26 52 26 5...
output:
1521 1093 1092 1091 490 1090 1089 1088 1521 250 1087 1086 51 101 1085 1520 1084 1083 1082 1081 99 49 1519 1080 1518 1079 246 1517 1340 3 487 4 1078 1077 1076 63 1339 1338 25 1075 1074 481 1073 1072 1337 1071 1070 1336 1069 3 1068 480 1516 1067 1515 1066 1065 233 1064 30 102 1063 1062 1061 477 14 69 ...
result:
ok ok
Test #57:
score: 32
Accepted
time: 350ms
memory: 80292kb
input:
6 428 1031 1178 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 24 49 25 50 25 51 26 52 26 5...
output:
747 747 587 586 736 585 584 583 746 745 57 735 734 744 733 743 582 581 580 732 93 579 18 731 578 730 742 577 576 575 729 574 741 573 572 728 28 61 727 571 570 569 568 567 82 81 566 740 8 565 32 564 563 739 91 738 737 63 562 726 77 561 60 560 559 725 59 58 558 736 557 556 555 20 724 554 553 90 552 55...
result:
ok ok
Test #58:
score: 32
Accepted
time: 349ms
memory: 78896kb
input:
6 433 1412 1032 1 2 1 3 3 4 3 5 5 6 6 7 3 8 3 9 3 10 6 11 3 12 3 13 6 14 4 15 4 16 2 17 6 18 2 19 1 20 1 21 2 22 5 23 4 24 3 25 2 26 4 27 1 28 5 29 1 30 6 31 1 32 4 33 3 34 4 35 3 36 4 37 4 38 3 39 6 40 1 41 1 42 4 43 1 44 2 45 3 46 3 47 5 48 6 49 5 50 4 51 4 52 3 53 3 54 1 55 2 56 2 57 3 58 3 59 2 ...
output:
344 148 344 277 276 275 274 343 273 342 272 341 271 270 269 340 268 144 267 266 265 264 263 339 113 338 262 261 260 259 337 143 258 257 336 335 256 334 255 254 333 332 253 331 330 252 251 250 329 249 328 248 247 246 245 244 243 242 327 326 241 240 325 239 238 237 324 112 323 322 321 320 142 236 235 ...
result:
ok ok
Test #59:
score: 32
Accepted
time: 347ms
memory: 81352kb
input:
6 441 1130 2385 1 2 1 3 1 4 1 5 1 6 1 7 1 8 1 9 1 10 7 11 4 12 10 13 1 14 13 15 2 16 12 17 14 18 3 19 19 20 6 21 17 22 11 23 9 24 15 25 16 26 20 27 8 28 21 29 5 30 26 31 27 32 18 33 23 34 22 35 35 36 31 37 33 38 37 39 24 40 40 41 30 42 25 43 41 44 28 45 29 46 44 47 45 48 38 49 47 50 36 51 34 52 48 5...
output:
730 730 729 12 4 728 727 726 725 724 723 403 3 35 722 204 721 720 134 81 719 87 718 34 410 7 149 349 717 716 49 715 186 148 428 402 361 260 382 714 713 147 209 712 711 710 332 200 328 709 92 58 708 91 707 125 99 8 320 413 234 247 385 365 249 132 427 153 706 705 58 401 325 704 703 353 164 426 702 199...
result:
ok ok
Test #60:
score: 32
Accepted
time: 612ms
memory: 145296kb
input:
6 2736 454986 470122 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...
output:
204856 93853 159215 83590 58255 186718 161626 25378 5198 15128 105051 83822 169805 69263 85049 172615 106791 14117 35278 68243 105455 12027 80556 131588 160754 181353 64271 88959 7245 35827 86280 144023 68017 64213 118287 148421 30358 146833 85991 181172 94850 105227 15317 179480 93480 93743 132770 ...
result:
ok ok