QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#319134 | #7177. Many Many Cycles | superguymj | WA | 633ms | 4960kb | C++20 | 2.5kb | 2024-02-01 22:36:31 | 2024-02-01 22:36:31 |
Judging History
answer
#include<bits/stdc++.h>
#define rep(i,x,y) for(int i=x; i<=y; ++i)
#define repd(i,x,y) for(int i=x; i>=y; --i)
#define mid ((l+r)>>1)
#define lch (rt<<1)
#define rch (rt<<1|1)
#define pb push_back
using namespace std;
typedef long long LL;
typedef __int128 i128;
typedef long double ld;
typedef pair <int,int> pii;
const int N=5005;
int n,m,ans;
struct D{int u,v,c;} dat[N<<1];
int getint()
{
char ch;
int f=1;
while(!isdigit(ch=getchar())) if(ch=='-') f=-1;
int x=ch-48;
while(isdigit(ch=getchar())) x=x*10+ch-48;
return x*f;
}
LL getLL()
{
char ch;
int f=1;
while(!isdigit(ch=getchar())) if(ch=='-') f=-1;
LL x=ch-48;
while(isdigit(ch=getchar())) x=x*10+ch-48;
return x*f;
}
LL gcd(LL a,LL b) {return !b?a:gcd(b,a%b);}
struct Tree
{
int n;
vector <int> fa,f,d,son,siz,top;
vector <LL> len;
vector <vector <pii>> vt,res;
Tree(int _):n(_),fa(n+1),f(n+1),d(n+1),son(n+1),siz(n+1),top(n+1),len(n+1),
vt(n+1),res(n+1)
{
rep(i,1,n) fa[i]=i;
}
int getfa(int x)
{
return fa[x]==x?x:fa[x]=getfa(fa[x]);
}
void addedge(int u,int v,int c)
{
if(getfa(u)==getfa(v))
{
res[u].pb(make_pair(v,c));
return;
}
vt[u].pb(make_pair(v,c));
vt[v].pb(make_pair(u,c));
u=getfa(u);
v=getfa(v);
fa[u]=v;
}
void dfs1(int x,int fa,int dep)
{
d[x]=dep,f[x]=fa,siz[x]=1;
for(auto i:vt[x])
{
int v=i.first;
if(v==fa) continue;
len[v]=len[x]+i.second;
dfs1(v,x,dep+1),siz[x]+=siz[v];
if(!son[x] || siz[son[x]]<siz[v]) son[x]=v;
}
}
void dfs2(int x,int t)
{
top[x]=t;
if(son[x]) dfs2(son[x],t);
for(auto i:vt[x])
{
int v=i.first;
if(v==f[x] || v==son[x]) continue;
dfs2(v,v);
}
}
void init()
{
rep(i,1,n) if(fa[i]==i) dfs1(i,0,1),dfs2(i,i);
}
int lca(int u,int v)
{
while(top[u]!=top[v]) d[top[u]]>d[top[v]]?u=f[top[u]]:v=f[top[v]];
return d[u]<d[v]?u:v;
}
LL dis(int u,int v) {return len[u]+len[v]-2*len[lca(u,v)];}
LL getans()
{
LL ret=0;
rep(x,1,n) for(auto i:res[x])
ret=gcd(ret,dis(x,i.first)+i.second);
return ret;
}
} ;
void solve()
{
n=getint(),m=getint();
rep(i,1,m) dat[i].u=getint(),dat[i].v=getint(),dat[i].c=getint();
rep(i,1,500)
{
random_shuffle(dat+1,dat+1+m);
Tree t(n);
rep(j,1,m) t.addedge(dat[j].u,dat[j].v,dat[j].c);
t.init();
ans=gcd(ans,t.getans());
}
printf("%lld\n",ans);
}
int main()
{
int T=1;
while(T--) solve();
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 1ms
memory: 4152kb
input:
4 4 1 2 1 2 3 1 3 4 1 4 1 1
output:
4
result:
ok answer is '4'
Test #2:
score: 0
Accepted
time: 0ms
memory: 3856kb
input:
4 5 1 2 1 1 3 2 1 4 1 2 3 1 3 4 1
output:
4
result:
ok answer is '4'
Test #3:
score: 0
Accepted
time: 3ms
memory: 4052kb
input:
20 50 1 2 8 1 3 1 3 4 5 3 5 9 3 6 5 6 7 6 7 8 8 2 9 2 8 10 3 8 11 7 8 12 5 3 13 4 7 14 3 6 15 7 9 16 6 8 17 7 16 18 9 16 19 3 18 20 10 11 3 2 17 1 1 16 2 2 15 1 1 10 3 2 9 1 2 19 2 1 6 1 2 7 3 1 17 3 2 15 3 2 8 6 2 5 1 2 8 1 2 12 1 1 12 7 1 4 1 2 18 2 1 11 7 1 14 1 1 18 1 1 18 9 1 10 6 1 14 3 2 20 2...
output:
2
result:
ok answer is '2'
Test #4:
score: 0
Accepted
time: 3ms
memory: 4084kb
input:
20 50 1 2 18468 1 3 26501 3 4 15725 3 5 29359 3 6 24465 6 7 28146 7 8 16828 2 9 492 8 10 11943 8 11 5437 8 12 14605 3 13 154 7 14 12383 6 15 18717 9 16 19896 8 17 21727 16 18 11539 16 19 19913 18 20 26300 11 3 2 17 1 1 16 2 2 15 1 1 10 3 2 9 1 2 19 2 1 6 1 2 7 3 1 17 3 2 15 3 2 8 6 2 5 1 2 8 1 2 12 ...
output:
1
result:
ok answer is '1'
Test #5:
score: 0
Accepted
time: 11ms
memory: 3768kb
input:
100 150 1 2 184676335 1 3 191705725 1 4 293606963 1 5 57078146 2 6 168279962 6 7 29961943 5 8 54392392 5 9 39020154 5 10 123837422 7 11 197199896 3 12 217274772 7 13 18709913 6 14 263007036 11 15 287053812 3 16 303347674 9 17 151417712 17 18 68705548 15 19 326652758 12 20 128598724 2 21 275290779 11...
output:
3
result:
ok answer is '3'
Test #6:
score: 0
Accepted
time: 6ms
memory: 3832kb
input:
100 130 1 2 184676335 1 3 191705725 1 4 293606963 1 5 57078146 2 6 168279962 6 7 29961943 5 8 54392392 5 9 39020154 5 10 123837422 7 11 197199896 3 12 217274772 7 13 18709913 6 14 263007036 11 15 287053812 3 16 303347674 9 17 151417712 17 18 68705548 15 19 326652758 12 20 128598724 2 21 275290779 11...
output:
7
result:
ok answer is '7'
Test #7:
score: 0
Accepted
time: 12ms
memory: 4084kb
input:
100 200 1 2 184676335 1 3 191705725 1 4 293606963 1 5 57078146 2 6 168279962 6 7 29961943 5 8 54392392 5 9 39020154 5 10 123837422 7 11 197199896 3 12 217274772 7 13 18709913 6 14 263007036 11 15 287053812 3 16 303347674 9 17 151417712 17 18 68705548 15 19 326652758 12 20 128598724 2 21 275290779 11...
output:
4
result:
ok answer is '4'
Test #8:
score: 0
Accepted
time: 12ms
memory: 3860kb
input:
100 190 1 2 184676335 1 3 191705725 1 4 293606963 1 5 57078146 2 6 168279962 6 7 29961943 5 8 54392392 5 9 39020154 5 10 123837422 7 11 197199896 3 12 217274772 7 13 18709913 6 14 263007036 11 15 287053812 3 16 303347674 9 17 151417712 17 18 68705548 15 19 326652758 12 20 128598724 2 21 275290779 11...
output:
2
result:
ok answer is '2'
Test #9:
score: 0
Accepted
time: 100ms
memory: 4036kb
input:
1000 1500 1 2 184676335 1 3 191705725 1 4 293606963 1 5 57078146 2 6 168279962 6 7 29961943 5 8 54392392 5 9 39020154 5 10 123837422 7 11 197199896 3 12 217274772 7 13 18709913 6 14 263007036 11 15 287053812 3 16 303347674 9 17 151417712 17 18 68705548 15 19 326652758 12 20 128598724 2 21 275290779 ...
output:
3
result:
ok answer is '3'
Test #10:
score: 0
Accepted
time: 99ms
memory: 4032kb
input:
1000 1500 1 2 184676335 1 3 191705725 1 4 293606963 1 5 57078146 2 6 168279962 6 7 29961943 5 8 54392392 5 9 39020154 5 10 123837422 7 11 197199896 3 12 217274772 7 13 18709913 6 14 263007036 11 15 287053812 3 16 303347674 9 17 151417712 17 18 68705548 15 19 326652758 12 20 128598724 2 21 275290779 ...
output:
1
result:
ok answer is '1'
Test #11:
score: 0
Accepted
time: 103ms
memory: 3900kb
input:
1000 1600 1 2 184676335 1 3 191705725 1 4 293606963 1 5 57078146 2 6 168279962 6 7 29961943 5 8 54392392 5 9 39020154 5 10 123837422 7 11 197199896 3 12 217274772 7 13 18709913 6 14 263007036 11 15 287053812 3 16 303347674 9 17 151417712 17 18 68705548 15 19 326652758 12 20 128598724 2 21 275290779 ...
output:
1
result:
ok answer is '1'
Test #12:
score: 0
Accepted
time: 12ms
memory: 3744kb
input:
100 190 1 2 184676335 1 3 191705725 1 4 293606963 1 5 57078146 2 6 168279962 6 7 29961943 5 8 54392392 5 9 39020154 5 10 123837422 7 11 197199896 3 12 217274772 7 13 18709913 6 14 263007036 11 15 287053812 3 16 303347674 9 17 151417712 17 18 68705548 15 19 326652758 12 20 128598724 2 21 275290779 11...
output:
4
result:
ok answer is '4'
Test #13:
score: 0
Accepted
time: 153ms
memory: 4272kb
input:
1000 3000 1 2 184676335 1 3 191705725 1 4 293606963 1 5 57078146 2 6 168279962 6 7 29961943 5 8 54392392 5 9 39020154 5 10 123837422 7 11 197199896 3 12 217274772 7 13 18709913 6 14 263007036 11 15 287053812 3 16 303347674 9 17 151417712 17 18 68705548 15 19 326652758 12 20 128598724 2 21 275290779 ...
output:
2
result:
ok answer is '2'
Test #14:
score: 0
Accepted
time: 90ms
memory: 4300kb
input:
1000 1400 1 2 184676335 1 3 191705725 1 4 293606963 1 5 57078146 2 6 168279962 6 7 29961943 5 8 54392392 5 9 39020154 5 10 123837422 7 11 197199896 3 12 217274772 7 13 18709913 6 14 263007036 11 15 287053812 3 16 303347674 9 17 151417712 17 18 68705548 15 19 326652758 12 20 128598724 2 21 275290779 ...
output:
1
result:
ok answer is '1'
Test #15:
score: 0
Accepted
time: 99ms
memory: 3972kb
input:
1000 1500 1 2 184676335 1 3 191705725 1 4 293606963 1 5 57078146 2 6 168279962 6 7 29961943 5 8 54392392 5 9 39020154 5 10 123837422 7 11 197199896 3 12 217274772 7 13 18709913 6 14 263007036 11 15 287053812 3 16 303347674 9 17 151417712 17 18 68705548 15 19 326652758 12 20 128598724 2 21 275290779 ...
output:
2
result:
ok answer is '2'
Test #16:
score: 0
Accepted
time: 96ms
memory: 4036kb
input:
1000 1500 1 2 184676335 1 3 191705725 1 4 293606963 1 5 57078146 2 6 168279962 6 7 29961943 5 8 54392392 5 9 39020154 5 10 123837422 7 11 197199896 3 12 217274772 7 13 18709913 6 14 263007036 11 15 287053812 3 16 303347674 9 17 151417712 17 18 68705548 15 19 326652758 12 20 128598724 2 21 275290779 ...
output:
8
result:
ok answer is '8'
Test #17:
score: 0
Accepted
time: 170ms
memory: 4224kb
input:
2000 2500 1 2 22794613 1 3 23670271 1 4 36254735 1 5 7068116 2 6 20774480 6 7 3707773 5 8 6740416 5 9 4815222 5 10 15296810 7 11 24351908 3 12 26824656 7 13 2326259 6 14 32470002 11 15 35443314 3 16 37448596 9 17 18691706 17 18 8500660 15 19 40337666 12 20 15876730 2 21 33971565 11 22 3767381 17 23 ...
output:
12
result:
ok answer is '12'
Test #18:
score: 0
Accepted
time: 175ms
memory: 4472kb
input:
2000 2500 1 2 22794613 1 3 23670271 1 4 36254735 1 5 7068116 2 6 20774480 6 7 3707773 5 8 6740416 5 9 4815222 5 10 15296810 7 11 24351908 3 12 26824656 7 13 2326259 6 14 32470002 11 15 35443314 3 16 37448596 9 17 18691706 17 18 8500660 15 19 40337666 12 20 15876730 2 21 33971565 11 22 3767381 17 23 ...
output:
2
result:
ok answer is '2'
Test #19:
score: 0
Accepted
time: 176ms
memory: 4056kb
input:
2000 2500 1 2 22794613 1 3 23670271 1 4 36254735 1 5 7068116 2 6 20774480 6 7 3707773 5 8 6740416 5 9 4815222 5 10 15296810 7 11 24351908 3 12 26824656 7 13 2326259 6 14 32470002 11 15 35443314 3 16 37448596 9 17 18691706 17 18 8500660 15 19 40337666 12 20 15876730 2 21 33971565 11 22 3767381 17 23 ...
output:
13
result:
ok answer is '13'
Test #20:
score: 0
Accepted
time: 177ms
memory: 4352kb
input:
2000 2500 1 2 22794613 1 3 23670271 1 4 36254735 1 5 7068116 2 6 20774480 6 7 3707773 5 8 6740416 5 9 4815222 5 10 15296810 7 11 24351908 3 12 26824656 7 13 2326259 6 14 32470002 11 15 35443314 3 16 37448596 9 17 18691706 17 18 8500660 15 19 40337666 12 20 15876730 2 21 33971565 11 22 3767381 17 23 ...
output:
1
result:
ok answer is '1'
Test #21:
score: 0
Accepted
time: 201ms
memory: 4376kb
input:
2000 3000 1 2 22794613 1 3 23670271 1 4 36254735 1 5 7068116 2 6 20774480 6 7 3707773 5 8 6740416 5 9 4815222 5 10 15296810 7 11 24351908 3 12 26824656 7 13 2326259 6 14 32470002 11 15 35443314 3 16 37448596 9 17 18691706 17 18 8500660 15 19 40337666 12 20 15876730 2 21 33971565 11 22 3767381 17 23 ...
output:
3
result:
ok answer is '3'
Test #22:
score: 0
Accepted
time: 202ms
memory: 4420kb
input:
2000 3000 1 2 22794613 1 3 23670271 1 4 36254735 1 5 7068116 2 6 20774480 6 7 3707773 5 8 6740416 5 9 4815222 5 10 15296810 7 11 24351908 3 12 26824656 7 13 2326259 6 14 32470002 11 15 35443314 3 16 37448596 9 17 18691706 17 18 8500660 15 19 40337666 12 20 15876730 2 21 33971565 11 22 3767381 17 23 ...
output:
1
result:
ok answer is '1'
Test #23:
score: 0
Accepted
time: 175ms
memory: 4104kb
input:
2000 2500 1 2 22794613 1 3 23670271 1 4 36254735 1 5 7068116 2 6 20774480 6 7 3707773 5 8 6740416 5 9 4815222 5 10 15296810 7 11 24351908 3 12 26824656 7 13 2326259 6 14 32470002 11 15 35443314 3 16 37448596 9 17 18691706 17 18 8500660 15 19 40337666 12 20 15876730 2 21 33971565 11 22 3767381 17 23 ...
output:
1
result:
ok answer is '1'
Test #24:
score: 0
Accepted
time: 223ms
memory: 4128kb
input:
2000 3500 1 2 22794613 1 3 23670271 1 4 36254735 1 5 7068116 2 6 20774480 6 7 3707773 5 8 6740416 5 9 4815222 5 10 15296810 7 11 24351908 3 12 26824656 7 13 2326259 6 14 32470002 11 15 35443314 3 16 37448596 9 17 18691706 17 18 8500660 15 19 40337666 12 20 15876730 2 21 33971565 11 22 3767381 17 23 ...
output:
2
result:
ok answer is '2'
Test #25:
score: 0
Accepted
time: 240ms
memory: 4400kb
input:
2000 4000 1 2 22794613 1 3 23670271 1 4 36254735 1 5 7068116 2 6 20774480 6 7 3707773 5 8 6740416 5 9 4815222 5 10 15296810 7 11 24351908 3 12 26824656 7 13 2326259 6 14 32470002 11 15 35443314 3 16 37448596 9 17 18691706 17 18 8500660 15 19 40337666 12 20 15876730 2 21 33971565 11 22 3767381 17 23 ...
output:
4
result:
ok answer is '4'
Test #26:
score: 0
Accepted
time: 162ms
memory: 4108kb
input:
2000 2300 1 2 22794613 1 3 23670271 1 4 36254735 1 5 7068116 2 6 20774480 6 7 3707773 5 8 6740416 5 9 4815222 5 10 15296810 7 11 24351908 3 12 26824656 7 13 2326259 6 14 32470002 11 15 35443314 3 16 37448596 9 17 18691706 17 18 8500660 15 19 40337666 12 20 15876730 2 21 33971565 11 22 3767381 17 23 ...
output:
1
result:
ok answer is '1'
Test #27:
score: 0
Accepted
time: 324ms
memory: 4248kb
input:
3000 5000 1 2 22794613 1 3 23670271 1 4 36254735 1 5 7068116 2 6 20774480 6 7 3707773 5 8 6740416 5 9 4815222 5 10 15296810 7 11 24351908 3 12 26824656 7 13 2326259 6 14 32470002 11 15 35443314 3 16 37448596 9 17 18691706 17 18 8500660 15 19 40337666 12 20 15876730 2 21 33971565 11 22 3767381 17 23 ...
output:
1
result:
ok answer is '1'
Test #28:
score: 0
Accepted
time: 259ms
memory: 4460kb
input:
3000 3700 1 2 22794613 1 3 23670271 1 4 36254735 1 5 7068116 2 6 20774480 6 7 3707773 5 8 6740416 5 9 4815222 5 10 15296810 7 11 24351908 3 12 26824656 7 13 2326259 6 14 32470002 11 15 35443314 3 16 37448596 9 17 18691706 17 18 8500660 15 19 40337666 12 20 15876730 2 21 33971565 11 22 3767381 17 23 ...
output:
13
result:
ok answer is '13'
Test #29:
score: 0
Accepted
time: 259ms
memory: 4200kb
input:
3000 3700 1 2 22794613 1 3 23670271 1 4 36254735 1 5 7068116 2 6 20774480 6 7 3707773 5 8 6740416 5 9 4815222 5 10 15296810 7 11 24351908 3 12 26824656 7 13 2326259 6 14 32470002 11 15 35443314 3 16 37448596 9 17 18691706 17 18 8500660 15 19 40337666 12 20 15876730 2 21 33971565 11 22 3767381 17 23 ...
output:
1
result:
ok answer is '1'
Test #30:
score: 0
Accepted
time: 540ms
memory: 4716kb
input:
5000 8000 1 2 22794613 1 3 23670271 1 4 36254735 1 5 7068116 2 6 20774480 6 7 3707773 5 8 6740416 5 9 4815222 5 10 15296810 7 11 24351908 3 12 26824656 7 13 2326259 6 14 32470002 11 15 35443314 3 16 37448596 9 17 18691706 17 18 8500660 15 19 40337666 12 20 15876730 2 21 33971565 11 22 3767381 17 23 ...
output:
3
result:
ok answer is '3'
Test #31:
score: 0
Accepted
time: 540ms
memory: 4628kb
input:
5000 8000 1 2 22794613 1 3 23670271 1 4 36254735 1 5 7068116 2 6 20774480 6 7 3707773 5 8 6740416 5 9 4815222 5 10 15296810 7 11 24351908 3 12 26824656 7 13 2326259 6 14 32470002 11 15 35443314 3 16 37448596 9 17 18691706 17 18 8500660 15 19 40337666 12 20 15876730 2 21 33971565 11 22 3767381 17 23 ...
output:
1
result:
ok answer is '1'
Test #32:
score: 0
Accepted
time: 496ms
memory: 4724kb
input:
5000 7200 1 2 22794613 1 3 23670271 1 4 36254735 1 5 7068116 2 6 20774480 6 7 3707773 5 8 6740416 5 9 4815222 5 10 15296810 7 11 24351908 3 12 26824656 7 13 2326259 6 14 32470002 11 15 35443314 3 16 37448596 9 17 18691706 17 18 8500660 15 19 40337666 12 20 15876730 2 21 33971565 11 22 3767381 17 23 ...
output:
5
result:
ok answer is '5'
Test #33:
score: 0
Accepted
time: 500ms
memory: 4508kb
input:
5000 7200 1 2 22794613 1 3 23670271 1 4 36254735 1 5 7068116 2 6 20774480 6 7 3707773 5 8 6740416 5 9 4815222 5 10 15296810 7 11 24351908 3 12 26824656 7 13 2326259 6 14 32470002 11 15 35443314 3 16 37448596 9 17 18691706 17 18 8500660 15 19 40337666 12 20 15876730 2 21 33971565 11 22 3767381 17 23 ...
output:
1
result:
ok answer is '1'
Test #34:
score: 0
Accepted
time: 538ms
memory: 4624kb
input:
5000 8000 1 2 22794613 1 3 23670271 1 4 36254735 1 5 7068116 2 6 20774480 6 7 3707773 5 8 6740416 5 9 4815222 5 10 15296810 7 11 24351908 3 12 26824656 7 13 2326259 6 14 32470002 11 15 35443314 3 16 37448596 9 17 18691706 17 18 8500660 15 19 40337666 12 20 15876730 2 21 33971565 11 22 3767381 17 23 ...
output:
6
result:
ok answer is '6'
Test #35:
score: 0
Accepted
time: 542ms
memory: 4536kb
input:
5000 8000 1 2 22794613 1 3 23670271 1 4 36254735 1 5 7068116 2 6 20774480 6 7 3707773 5 8 6740416 5 9 4815222 5 10 15296810 7 11 24351908 3 12 26824656 7 13 2326259 6 14 32470002 11 15 35443314 3 16 37448596 9 17 18691706 17 18 8500660 15 19 40337666 12 20 15876730 2 21 33971565 11 22 3767381 17 23 ...
output:
2
result:
ok answer is '2'
Test #36:
score: 0
Accepted
time: 630ms
memory: 4672kb
input:
5000 10000 1 2 4216811 1 3 4386257 1 4 6720587 1 5 1328886 2 6 3846518 6 7 694803 5 8 1271800 5 9 889810 5 10 2840518 7 11 4515600 3 12 4968300 7 13 446045 6 14 6013208 11 15 6568096 3 16 6933598 9 17 3459860 17 18 1591452 15 19 7479694 12 20 2940576 2 21 6277391 11 22 714171 17 23 95771 2 24 205804...
output:
4
result:
ok answer is '4'
Test #37:
score: 0
Accepted
time: 633ms
memory: 4960kb
input:
5000 10000 1 2 4216811 1 3 4386257 1 4 6720587 1 5 1328886 2 6 3846518 6 7 694803 5 8 1271800 5 9 889810 5 10 2840518 7 11 4515600 3 12 4968300 7 13 446045 6 14 6013208 11 15 6568096 3 16 6933598 9 17 3459860 17 18 1591452 15 19 7479694 12 20 2940576 2 21 6277391 11 22 714171 17 23 95771 2 24 205804...
output:
2
result:
ok answer is '2'
Test #38:
score: 0
Accepted
time: 435ms
memory: 4560kb
input:
5000 6000 1 2 4216811 1 3 4386257 1 4 6720587 1 5 1328886 2 6 3846518 6 7 694803 5 8 1271800 5 9 889810 5 10 2840518 7 11 4515600 3 12 4968300 7 13 446045 6 14 6013208 11 15 6568096 3 16 6933598 9 17 3459860 17 18 1591452 15 19 7479694 12 20 2940576 2 21 6277391 11 22 714171 17 23 95771 2 24 2058041...
output:
7
result:
ok answer is '7'
Test #39:
score: 0
Accepted
time: 435ms
memory: 4648kb
input:
5000 6000 1 2 4216811 1 3 4386257 1 4 6720587 1 5 1328886 2 6 3846518 6 7 694803 5 8 1271800 5 9 889810 5 10 2840518 7 11 4515600 3 12 4968300 7 13 446045 6 14 6013208 11 15 6568096 3 16 6933598 9 17 3459860 17 18 1591452 15 19 7479694 12 20 2940576 2 21 6277391 11 22 714171 17 23 95771 2 24 2058041...
output:
1
result:
ok answer is '1'
Test #40:
score: 0
Accepted
time: 442ms
memory: 4524kb
input:
5000 6000 1 2 4216811 1 3 4386257 1 4 6720587 1 5 1328886 2 6 3846518 6 7 694803 5 8 1271800 5 9 889810 5 10 2840518 7 11 4515600 3 12 4968300 7 13 446045 6 14 6013208 11 15 6568096 3 16 6933598 9 17 3459860 17 18 1591452 15 19 7479694 12 20 2940576 2 21 6277391 11 22 714171 17 23 95771 2 24 2058041...
output:
2
result:
ok answer is '2'
Test #41:
score: 0
Accepted
time: 430ms
memory: 4528kb
input:
5000 6000 1 2 4216811 1 3 4386257 1 4 6720587 1 5 1328886 2 6 3846518 6 7 694803 5 8 1271800 5 9 889810 5 10 2840518 7 11 4515600 3 12 4968300 7 13 446045 6 14 6013208 11 15 6568096 3 16 6933598 9 17 3459860 17 18 1591452 15 19 7479694 12 20 2940576 2 21 6277391 11 22 714171 17 23 95771 2 24 2058041...
output:
9
result:
ok answer is '9'
Test #42:
score: 0
Accepted
time: 470ms
memory: 4656kb
input:
5000 6666 1 2 4216811 1 3 4386257 1 4 6720587 1 5 1328886 2 6 3846518 6 7 694803 5 8 1271800 5 9 889810 5 10 2840518 7 11 4515600 3 12 4968300 7 13 446045 6 14 6013208 11 15 6568096 3 16 6933598 9 17 3459860 17 18 1591452 15 19 7479694 12 20 2940576 2 21 6277391 11 22 714171 17 23 95771 2 24 2058041...
output:
9
result:
ok answer is '9'
Test #43:
score: 0
Accepted
time: 465ms
memory: 4684kb
input:
5000 6666 1 2 4216811 1 3 4386257 1 4 6720587 1 5 1328886 2 6 3846518 6 7 694803 5 8 1271800 5 9 889810 5 10 2840518 7 11 4515600 3 12 4968300 7 13 446045 6 14 6013208 11 15 6568096 3 16 6933598 9 17 3459860 17 18 1591452 15 19 7479694 12 20 2940576 2 21 6277391 11 22 714171 17 23 95771 2 24 2058041...
output:
1
result:
ok answer is '1'
Test #44:
score: 0
Accepted
time: 446ms
memory: 4476kb
input:
5000 6000 1 2 4216811 1 3 4386257 1 4 6720587 1 5 1328886 2 6 3846518 6 7 694803 5 8 1271800 5 9 889810 5 10 2840518 7 11 4515600 3 12 4968300 7 13 446045 6 14 6013208 11 15 6568096 3 16 6933598 9 17 3459860 17 18 1591452 15 19 7479694 12 20 2940576 2 21 6277391 11 22 714171 17 23 95771 2 24 2058041...
output:
12345
result:
ok answer is '12345'
Test #45:
score: 0
Accepted
time: 432ms
memory: 4620kb
input:
5000 6000 1 2 4216811 1 3 4386257 1 4 6720587 1 5 1328886 2 6 3846518 6 7 694803 5 8 1271800 5 9 889810 5 10 2840518 7 11 4515600 3 12 4968300 7 13 446045 6 14 6013208 11 15 6568096 3 16 6933598 9 17 3459860 17 18 1591452 15 19 7479694 12 20 2940576 2 21 6277391 11 22 714171 17 23 95771 2 24 2058041...
output:
997
result:
ok answer is '997'
Test #46:
score: 0
Accepted
time: 438ms
memory: 4756kb
input:
5000 6000 1 2 4216811 1 3 4386257 1 4 6720587 1 5 1328886 2 6 3846518 6 7 694803 5 8 1271800 5 9 889810 5 10 2840518 7 11 4515600 3 12 4968300 7 13 446045 6 14 6013208 11 15 6568096 3 16 6933598 9 17 3459860 17 18 1591452 15 19 7479694 12 20 2940576 2 21 6277391 11 22 714171 17 23 95771 2 24 2058041...
output:
1
result:
ok answer is '1'
Test #47:
score: 0
Accepted
time: 361ms
memory: 4580kb
input:
5000 4999 1 2 4216811 1 3 4386257 1 4 6720587 1 5 1328886 2 6 3846518 6 7 694803 5 8 1271800 5 9 889810 5 10 2840518 7 11 4515600 3 12 4968300 7 13 446045 6 14 6013208 11 15 6568096 3 16 6933598 9 17 3459860 17 18 1591452 15 19 7479694 12 20 2940576 2 21 6277391 11 22 714171 17 23 95771 2 24 2058041...
output:
0
result:
ok answer is '0'
Test #48:
score: -100
Wrong Answer
time: 1ms
memory: 4148kb
input:
6 6 1 2 999999999 2 3 999999999 3 4 999999999 4 5 999999999 5 6 999999999 6 1 999999999
output:
2
result:
wrong answer expected '5999999994', found '2'