QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#114388 | #1221. 情报中心 | yixiuge777 | 100 ✓ | 4438ms | 95040kb | C++14 | 7.7kb | 2023-06-22 00:24:36 | 2023-06-22 00:24:39 |
Judging History
answer
#include <bits/stdc++.h>
#define ll long long
#define N 200010
namespace IO{
#define BUF_SIZE (1<<16)
#define OUT_SIZE (1<<16)
bool IOerror=0;
inline char nc(){static char buf[BUF_SIZE],*p1=buf+BUF_SIZE,*pend=buf+BUF_SIZE;if(p1==pend){p1=buf;pend=buf+fread(buf,1,BUF_SIZE,stdin);if(pend==p1)return IOerror=1,-1;}return *p1++;}
inline bool blank(char ch){return ch==' '||ch=='\n'||ch=='\r'||ch=='\t';}
inline void read(int &x){bool sign=0;char ch=nc();x=0;for(;blank(ch);ch=nc());if(IOerror)return;if(ch=='-')sign=1,ch=nc();for(;ch>='0'&&ch<='9';ch=nc())x=x*10+ch-'0';if(sign)x=-x;}
inline void read(ll &x){bool sign=0;char ch=nc();x=0;for(;blank(ch);ch=nc());if(IOerror)return;if(ch=='-')sign=1,ch=nc();for(;ch>='0'&&ch<='9';ch=nc())x=x*10+ch-'0';if(sign)x=-x;}
inline void read(char *s){char ch=nc();for(;blank(ch);ch=nc());if(IOerror)return;for(;!blank(ch)&&!IOerror;ch=nc())*s++=ch;*s=0;}
inline void read(char &c){for(c=nc();blank(c);c=nc());if(IOerror){c=-1;return;}}
struct Ostream_fwrite{
char *buf,*p1,*pend;
Ostream_fwrite(){buf=new char[BUF_SIZE];p1=buf;pend=buf+BUF_SIZE;}
inline void out(char ch){if(p1==pend){fwrite(buf,1,BUF_SIZE,stdout);p1=buf;}*p1++=ch;}
inline void print(int x){static char s[15],*s1;s1=s;if(!x)*s1++='0';if(x<0)out('-'),x=-x;while(x)*s1++=x%10+'0',x/=10;while(s1--!=s)out(*s1);}
inline void println(int x){print(x);out('\n');}
inline void print(ll x){static char s[25],*s1;s1=s;if(!x)*s1++='0';if(x<0)out('-'),x=-x;while(x)*s1++=x%10+'0',x/=10;while(s1--!=s)out(*s1);}
inline void println(ll x){print(x);out('\n');}
inline void print(char *s){while(*s)out(*s++);}
inline void println(char *s){while(*s)out(*s++);out('\n');}
inline void flush(){if(p1!=buf){fwrite(buf,1,p1-buf,stdout);p1=buf;}}
~Ostream_fwrite(){flush();}
}Ostream;
inline void print(int x){Ostream.print(x);}
inline void println(int x){Ostream.println(x);}
inline void print(char x){Ostream.out(x);}
inline void println(char x){Ostream.out(x);Ostream.out('\n');}
inline void print(ll x){Ostream.print(x);}
inline void println(ll x){Ostream.println(x);}
inline void print(char *s){Ostream.print(s);}
inline void println(char *s){Ostream.println(s);}
inline void println(){Ostream.out('\n');}
inline void flush(){Ostream.flush();}
#undef OUT_SIZE
#undef BUF_SIZE
}using namespace IO;
int T,n,m,root[N],head[N],tot_edge,head1[N],tot_edge1;
ll ans;
struct edge{int v;ll w;int ne;}b[N];
void add_edge(int u,int v,ll w){
b[++tot_edge]=(edge){v,w,head[u]};
head[u]=tot_edge;
}
struct edge1{int v,ne;}b1[N];
void add_edge1(int u,int v){
b1[++tot_edge1]=(edge1){v,head1[u]};
head1[u]=tot_edge1;
}
/*
struct _{
int dfn[N],f[N][17],L[N],tot=0,d[N],fa[N][17];
ll d1[N];
void dfs(int x){
dfn[x]=++tot;
f[tot][0]=x;
for(int i=head[x];i;i=b[i].ne){
int v=b[i].v;
d[v]=d[x]+1;
d1[v]=d1[x]+b[i].w;
fa[v][0]=x;
dfs(v);
f[++tot][0]=x;
}
}
void swap(int &a,int &b){int w=a;a=b;b=w;}
int cmp(int x,int y){return d[x]<d[y]?x:y;}
int ask_lca(int x,int y){
x=dfn[x];y=dfn[y];if(x>y)swap(x,y);
return cmp(f[x][L[y-x+1]],f[y-(1<<L[y-x+1])+1][L[y-x+1]]);
}
int ask_kthfa(int u,int v){int k=d[u]-d[v]-1;for(int i=0;k;i++,k>>=1)if(k&1)u=fa[u][i];return u;}
void init(){for(int i=2;i<=100000;i++)L[i]=L[i>>1]+1;}
void mian(){
tot=0;d[1]=1;dfs(1);
for(int j=1;(1<<j)<=tot;j++)for(int i=1;i+(1<<j)-1<=tot;i++)f[i][j]=cmp(f[i][j-1],f[i+(1<<(j-1))][j-1]);
for(int j=1;(1<<j)<=n;j++)for(int i=1;i<=n;i++)fa[i][j]=fa[fa[i][j-1]][j-1];
}
ll ask_dis(int x,int y){return d1[x]+d1[y]-(d1[ask_lca(x,y)]<<1);}
}LCA;
*/
struct _1{
int d[N],s[N],son[N],top[N],id[N],dui[N],tot=0,fa[N];
ll d1[N];
void dfs1(int x){
s[x]=1;son[x]=0;
for(int i=head[x];i;i=b[i].ne){
int v=b[i].v;
d[v]=d[x]+1;d1[v]=d1[x]+b[i].w;
fa[v]=x;
dfs1(v);
s[x]+=s[v];
if(s[v]>s[son[x]])son[x]=v;
}
}
void dfs2(int x){
id[x]=++tot;
dui[tot]=x;
if(!son[x])return ;
top[son[x]]=top[x];dfs2(son[x]);
for(int i=head[x];i;i=b[i].ne){
int v=b[i].v;
if(v!=son[x]){top[v]=v;dfs2(v);}
}
}
int ask_kthfa(int x,int v){
while(d[fa[top[x]]]>d[v])x=fa[top[x]];
return dui[id[x]-(d[x]-d[v]-1)];
}
int ask_lca(int x,int y){
while(top[x]!=top[y])d[top[x]]>d[top[y]]?x=fa[top[x]]:y=fa[top[y]];
return d[x]<d[y]?x:y;
}
ll ask_dis(int x,int y){return d1[x]+d1[y]-(d1[ask_lca(x,y)]<<1);}
void mian(){
tot=0;
d[1]=1;dfs1(1);
top[1]=1;dfs2(1);
}
}LCA;
inline ll max(ll x,ll y){ll m=(x-y)>>63;return (y&m)|(x&~m);}
struct info{
int u;ll v;
inline friend ll operator+(info &x,info &y){return x.v+y.v+LCA.ask_dis(x.u,y.u);}
};
struct node{
info x,y;
inline friend node operator+(node &a,node &b){
if(!a.x.u)return b;
if(!b.x.u)return a;
info x1=a.x,x2=a.y,x3=b.x,x4=b.y;
ll w12=x1+x2;
ll w13=x1+x3;
ll w14=x1+x4;
ll w23=x2+x3;
ll w24=x2+x4;
ll w34=x3+x4;
ll maxn=std::max({w12,w13,w14,w23,w24,w34});
if(w12==maxn)return (node){x1,x2};
if(w13==maxn)return (node){x1,x3};
if(w14==maxn)return (node){x1,x4};
if(w23==maxn)return (node){x2,x3};
if(w24==maxn)return (node){x2,x4};
return (node){x3,x4};
}
inline friend node operator^(node &a,node &b){
if(!a.x.u||!b.x.u)return {{0,0},{0,0}};
info x1=a.x,x2=a.y,x3=b.x,x4=b.y;
ll w13=x1+x3;
ll w14=x1+x4;
ll w23=x2+x3;
ll w24=x2+x4;
ll maxn=std::max({w13,w14,w23,w24});
if(w13==maxn)return (node){x1,x3};
if(w14==maxn)return (node){x1,x4};
if(w23==maxn)return (node){x2,x3};
return (node){x2,x4};
}
inline void del(){x.u=y.u=0;}
inline ll val(){return x+y;}
inline bool check(){return x.u&&y.u;}
};
struct node1{
int ls,rs;
node w;
inline void del(){ls=rs=0;w.del();}
}t[N<<5];
int tot=0;
void refresh(int x){t[x].w=t[t[x].ls].w+t[t[x].rs].w;}
int insert(int l,int r,int L,info w1){
int x=++tot;
if(l==r){t[x].w.x=t[x].w.y=w1;return x;}
int mid=(l+r)>>1;
if(mid>=L)t[x].ls=insert(l,mid,L,w1);
else t[x].rs=insert(mid+1,r,L,w1);
refresh(x);return x;
}
void merge(int &x,int y){
if(!x||!y){x|=y;return ;}
merge(t[x].ls,t[y].ls);
merge(t[x].rs,t[y].rs);
refresh(x);
}
void erase(int x,int l,int r,int L){
if(l==r){t[x].w.del();return ;}
int mid=(l+r)>>1;
if(mid>=L)erase(t[x].ls,l,mid,L);
else erase(t[x].rs,mid+1,r,L);
refresh(x);
}
void dfs(int x){
for(int i=head[x];i;i=b[i].ne){
int v=b[i].v;
dfs(v);
node w=t[root[x]].w^t[root[v]].w;
if(w.check())ans=max(ans,w.val()-(LCA.d1[x]<<1));
merge(root[x],root[v]);
}
for(int i=head1[x];i;i=b1[i].ne)erase(root[x],1,m,b1[i].v);
}
int main(){
// freopen("ex_center4.in","r",stdin);
// freopen("data.out","w",stdout);
// LCA.init();
read(T);
while(T--)
{
ans=-1e17;
read(n);
for(int i=1;i<=n;i++)head[i]=head1[i]=root[i]=0;
tot_edge=tot_edge1=0;
for(int i=1;i<n;i++){int u,v;ll w;read(u);read(v);read(w);add_edge(u,v,w);}
LCA.mian();
read(m);
for(int i=1;i<=m;i++){
int u,v;ll y;
read(u);read(v);read(y);
if(u==v)continue;
int t1=LCA.ask_lca(u,v);
if(u!=t1){
int rt=insert(1,m,i,{v,LCA.ask_dis(u,v)-(y<<1)+LCA.d1[u]});
node w=t[rt].w^t[root[u]].w;
if(w.check())ans=max(ans,w.val()-(LCA.d1[u]<<1));
merge(root[u],rt);
add_edge1(LCA.ask_kthfa(u,t1),i);
}
if(v!=t1){
int rt=insert(1,m,i,{u,LCA.ask_dis(u,v)-(y<<1)+LCA.d1[v]});
node w=t[rt].w^t[root[v]].w;
if(w.check())ans=max(ans,w.val()-(LCA.d1[v]<<1));
merge(root[v],rt);
add_edge1(LCA.ask_kthfa(v,t1),i);
}
}
dfs(1);
if(ans<(-1e16))print('F');
else print(ans>>1);
print('\n');
for(int i=1;i<=tot;i++)t[i].del();
tot=0;
}
flush();
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 5
Accepted
time: 1ms
memory: 15752kb
input:
50 2 1 2 746646706 3 2 2 158805763 2 2 0 1 2 2769010819 2 1 2 914572059 3 1 2 213930211 1 2 0 2 2 0 2 1 2 34149275 3 2 2 0 2 2 149024832 1 2 51053526 2 1 2 254241277 3 1 2 1309599026 2 2 595790294 2 2 0 2 1 2 924293412 3 2 2 0 1 2 70948322 1 2 0 2 1 2 120085940 3 2 2 1098008767 1 2 810803844 2 2 0 2...
output:
F 700641848 F F 853345090 F F F F -335765973 -110088395 628034705 -739879674 F -230306371 F -930847753 F F F -30368435 -968210783 F -37453013 F 504996844 -691329611 -372260994 F -368763136 F F F -736440738 -810618582 -962172530 -932830591 F F F F -550044940 F F F 401662489 887352043 F F F
result:
ok 50 lines
Test #2:
score: 5
Accepted
time: 1ms
memory: 17952kb
input:
50 10 1 2 831025401 2 3 17043499 1 4 749476846 4 5 605299999 5 6 350873404 6 7 300659907 3 8 406207791 2 9 612660130 7 10 685646376 30 5 6 5064476579 8 8 0 10 10 0 4 5 3660445897 5 10 0 1 9 3660446885 6 7 5064475522 10 10 0 9 9 0 9 5 2865312306 5 7 5064476497 1 2 3660446441 10 10 0 9 9 0 7 10 506447...
output:
-3727295827 94493183 -14678941917 -5574054938 -7077139744 -10056542275 -854708313 -1232365188 -1624606576 -3583909712 -4938133815 -3390253798 -2510752091 -3034158008 -9061709536 -4499610484 -16383580023 -3540735974 -5742888154 -13867296727 -129275888 -11268675743 -3506123988 -13061258642 -1259273401...
result:
ok 50 lines
Test #3:
score: 5
Accepted
time: 5ms
memory: 18028kb
input:
50 200 1 2 132111514 2 3 218131072 3 4 457215808 4 5 210986346 5 6 32656300 6 7 953848206 7 8 154372080 4 9 645141857 9 10 130431237 10 11 415254862 11 12 4997839 8 13 390836759 13 14 640820749 14 15 434042079 15 16 104914370 13 17 363230490 17 18 580147701 17 19 673888862 18 20 464984592 18 21 8971...
output:
-261752610227 -337359051035 -343052587137 -328746209177 -383230409943 -330260132899 -368099811256 -377000149542 -396003263288 -356047137666 -371526095741 -382726097943 -387226690572 -352656304895 -359667344913 -272902489670 -364540214399 -375996045862 -338606666535 -345324110277 -351499738971 -29117...
result:
ok 50 lines
Test #4:
score: 5
Accepted
time: 93ms
memory: 16956kb
input:
50 1000 1 2 439832276 2 3 836243890 3 4 799707681 4 5 879910718 5 6 261426008 6 7 321744006 7 8 644692206 8 9 513339643 9 10 707526649 10 11 390866232 11 12 180191034 12 13 866347596 13 14 702663145 14 15 662968598 15 16 516515411 16 17 905600811 17 18 85093051 18 19 348354946 19 20 542342095 20 21 ...
output:
-387043132469 -340561505600 75567699398 -89729188682 -353407501761 204502503267 -30243132977 -478835907355 -1086596461168 2199418250 -30315033115 -241651591563 -27953672042 -153026465316 -30643558892 -132251459569 260936547737 7935009036 -68295008622 -29733587030 -66102890993 -63930483585 3574576099...
result:
ok 50 lines
Test #5:
score: 5
Accepted
time: 2344ms
memory: 37968kb
input:
50 10000 1 2 864795802 2 3 3403898 3 4 404669874 4 5 104167086 5 6 447854285 6 7 478945838 7 8 277689928 8 9 530617846 9 10 341566235 10 11 426405663 11 12 916935917 12 13 660083740 13 14 866393523 14 15 217696996 15 16 751829899 16 17 480895442 17 18 124930746 18 19 65254843 19 20 841561751 20 21 2...
output:
-771938006413 -952145011970 -6813288531357 -1220411204311 -1298475812381 -1919630340406 -1707167565636 1223194732406 -3630699775196 -2066478342702 -4272718618922 -1865120625192 96648203485 245577835900 -1899362228818 68411064785 -725056100835 -1514985278 -241233726591 -3167720520372 -856413502472 18...
result:
ok 50 lines
Test #6:
score: 5
Accepted
time: 4438ms
memory: 95040kb
input:
20 50000 1 2 179783342 2 3 329307163 3 4 28763311 4 5 770116486 5 6 158010688 6 7 275523671 7 8 229341032 8 9 631721084 9 10 260390410 10 11 3652020 11 12 966032435 12 13 266184745 13 14 261993661 14 15 70492909 15 16 185073157 16 17 972287824 17 18 88966733 18 19 164551608 19 20 794904463 20 21 644...
output:
-4449608823265 -7460132298744 3125390209126 -8858454992059 -1331182179021 -22035288523727 -11280489810997 -7031519746696 -965629505255 -7647551004442 -8981058226914 -28023775400866 -4090460674620 -11780538861976 -15522579962636 -1476770034776 -14851945199590 -8443929185792 -2888846676635 -6037290917...
result:
ok 20 lines
Test #7:
score: 5
Accepted
time: 931ms
memory: 37268kb
input:
50 10000 1 2 0 2 3 0 3 4 0 4 5 0 5 6 0 6 7 0 7 8 0 8 9 0 9 10 0 10 11 0 11 12 0 12 13 0 13 14 0 14 15 0 15 16 0 16 17 0 17 18 0 18 19 0 19 20 0 20 21 0 21 22 0 22 23 0 23 24 0 24 25 0 25 26 0 26 27 0 27 28 0 28 29 0 29 30 0 30 31 0 31 32 0 32 33 0 33 34 0 34 35 0 35 36 0 36 37 0 37 38 0 38 39 0 5 40...
output:
-19633628696464 -19972167949371 -19978977724922 -19960457806556 -19898960412282 -19973399558424 -19926493255854 -19908054421275 -19902482163964 -19984448058447 -19903300687300 -19908478572948 -19981932107556 -19967569982098 -19822605774736 -19816699997242 -19980738186899 -19979700882807 -19944073444...
result:
ok 50 lines
Test #8:
score: 5
Accepted
time: 1831ms
memory: 81680kb
input:
20 50000 1 2 0 2 3 0 2 4 0 3 5 0 3 6 0 4 7 0 4 8 0 5 9 0 5 10 0 6 11 0 6 12 0 7 13 0 7 14 0 8 15 0 8 16 0 9 17 0 9 18 0 10 19 0 10 20 0 11 21 0 11 22 0 12 23 0 12 24 0 13 25 0 13 26 0 14 27 0 14 28 0 15 29 0 15 30 0 16 31 0 16 32 0 17 33 0 17 34 0 18 35 0 18 36 0 19 37 0 19 38 0 20 39 0 20 40 0 21 4...
output:
-99989614381748 -99946687145289 -99865129675056 -99972360680249 -99887318868496 -99747478037808 -99984925882202 -99823114630905 -99985660996219 -99879938203299 -99941542372879 -99978008313577 -99428668939674 -99983495501272 -99931884347866 -99943955409968 -99956654218312 -99976018114299 -99952032514...
result:
ok 20 lines
Test #9:
score: 5
Accepted
time: 2066ms
memory: 79924kb
input:
20 50000 1 2 0 2 3 0 3 4 0 2 5 0 2 6 0 5 7 0 2 8 0 6 9 0 8 10 0 7 11 0 7 12 0 8 13 0 11 14 0 11 15 0 4 16 0 16 17 0 12 18 0 14 19 0 8 20 0 7 21 0 19 22 0 22 23 0 14 24 0 6 25 0 22 26 0 14 27 0 25 28 0 27 29 0 5 30 0 21 31 0 30 32 0 31 33 0 9 34 0 11 35 0 2 36 0 13 37 0 8 38 0 30 39 0 36 40 0 12 41 0...
output:
-99985725110235 -99924528695125 -99946341642656 -99925574752742 -99900022970241 -99950062227901 -99980801535601 -99990784668064 -99902086800088 -99950302279692 -99968564209835 -99974658942435 -99978551916814 -99990872190677 -99974412576331 -99921837152647 -99974580050419 -99976441855815 -99975364788...
result:
ok 20 lines
Test #10:
score: 5
Accepted
time: 294ms
memory: 22368kb
input:
50 10000 1 2 424058411 2 3 364092764 3 4 649569637 4 5 107311821 5 6 589201681 6 7 837804270 7 8 477845409 8 9 622129179 9 10 815005658 10 11 882812530 11 12 954467751 12 13 528654134 13 14 423064704 14 15 883902940 15 16 241202437 16 17 311119773 17 18 260729530 18 19 471785092 19 20 943699288 20 2...
output:
-20150081524372 -19935359459085 -19991391425812 -19964303642141 -19932850212415 -20018461752434 -19898834682697 -20221127408868 -19903677164224 -19836221080562 -20145587641005 -19908956376091 -19978915091758 -20012947984620 -19866973120827 -20362005593340 -19694301832064 -19901917239424 -19869268398...
result:
ok 50 lines
Test #11:
score: 5
Accepted
time: 638ms
memory: 45356kb
input:
10092 13 1 2 376012308 2 3 872641596 2 4 969503104 3 5 493821196 3 6 412025108 1 7 712126023 6 8 245269838 2 9 50554104 9 10 452044647 4 11 24996801 6 12 999619302 3 13 243974212 13 12 9 2444221107 5 12 0 11 11 0 5 5 0 9 10 0 13 13 0 8 12 1766295001 7 7 0 8 8 0 10 10 0 12 12 0 4 11 0 2 7 0 20 1 2 85...
output:
384440443 -25595119423 -4780450131 -14969681093 -18456652728 -21505347020 6105779371 -17712338102 -440493324 -292099713 -20019099444 -25194100447 -35660658441 -4506131481 -22228045496 -5678548415 2500841277 -22303398918 -1422733793 -14598742323 -30540261882 -9262580525 -32123364738 -13283978303 -208...
result:
ok 10092 lines
Test #12:
score: 5
Accepted
time: 872ms
memory: 45220kb
input:
4921 17 1 2 532882055 2 3 812171282 2 4 78207404 4 5 114730827 5 6 808506705 4 7 333878950 7 8 775477644 7 9 848363535 7 10 821481422 10 11 357375658 11 12 99238276 12 13 895564470 13 14 682306056 2 15 665054341 6 16 223659235 16 17 471478148 17 5 6 120 6 16 0 16 17 0 11 12 213724534 3 3 0 9 9 0 8 9...
output:
-9856313382 -10800003054 -8060685665 528126548 -3967395385683 -17401875541 -9605581143 -1451946209 -27150279567 -12846547323 -30570253352 -26200749160 -4640130780 -14993957700 -27712754628 -24352330307 -26438917639 F -17614421245 -9946318755 -8537573137 -8145086848 -25282796313 -9072193228 -13437672...
result:
ok 4921 lines
Test #13:
score: 5
Accepted
time: 2297ms
memory: 36040kb
input:
50 10000 1 2 416427278 2 3 644054069 3 4 472419584 4 5 154841243 5 6 740229548 6 7 805647275 7 8 25893196 8 9 402109497 9 10 623764898 10 11 847792914 11 12 986296046 12 13 179849710 13 14 156233946 14 15 619526335 15 16 764163002 16 17 623103830 17 18 557471591 18 19 486566895 19 20 831795278 20 21...
output:
203979053899 121688688010 135924842723 20117427285 222505809403 191014230692 204005486609 104543520395 74253437803 426961709317 174640375472 38643220593 42015029520 222620461564 13867225079 41018427291 12372790475 13506942112 116801205195 72086726330 25369264533 59847581244 92281679949 20604179587 9...
result:
ok 50 lines
Test #14:
score: 5
Accepted
time: 1748ms
memory: 33432kb
input:
50 10000 1 2 950613341 2 3 592354539 3 4 813579862 3 5 967703156 4 6 610563562 6 7 482990529 5 8 762382263 2 9 573202546 6 10 83067536 5 11 13525932 11 12 227298815 7 13 779836778 7 14 750761052 14 15 181469376 7 16 19494079 5 17 743988131 17 18 323746846 7 19 302470938 6 20 167831140 20 21 99446810...
output:
66606045624 31591160124 28335447831 99763890060 125045328170 14817482027 241336166201 36727477257 183955630011 360400153896 3252920970 80200634054 20945328006 113379894364 43685231850 86773801502 124055322659 190775337625 78454006503 68582744486 33330796344 119406417116 67934310087 98484719602 47724...
result:
ok 50 lines
Test #15:
score: 5
Accepted
time: 2413ms
memory: 87664kb
input:
22081 21 1 2 659538900 2 3 795240945 3 4 929891954 4 5 638901861 5 6 693009757 6 7 50043084 7 8 632298292 8 9 307442678 9 10 56547981 10 11 15119139 11 12 776486541 12 13 650964235 13 14 343976304 14 15 469141843 15 16 238930900 16 17 258933808 17 18 771996708 18 19 369254864 19 20 363658288 20 21 4...
output:
5444557908 2338968606 952589049 1125338653 -540251411 1904242819 3608514594 1158484927 834530699 2164403828 749788308 -433620404 1261578335 -871534946 -573838440 251939830 -1101080962 -354567573 1252198027 2880327249 3891696567 -997656292 -101851380 5098417709 920705795 -320653430 2747965123 3581118...
result:
ok 22081 lines
Test #16:
score: 5
Accepted
time: 2489ms
memory: 86560kb
input:
5216 24 1 2 220386131 2 3 622200460 3 4 441010465 4 5 944623977 4 6 311640313 6 7 467884482 6 8 358045567 6 9 743189991 4 10 189045271 10 11 847713463 10 12 439007770 10 13 156824893 7 14 236252645 14 15 675181812 15 16 762981343 15 17 329149230 9 18 399480293 18 19 447754501 19 20 735440113 9 21 69...
output:
1985614332 -63690958 9361238366 5392798027 -1618475011 622945115 2242578927 847697513 998949175 2354900796 1075197562 2310925811 7682834420 6344594239 -48660538 2965339522 1452096908 1703589050 1201385022 1133306090 2872451059 1017616339 431153934 1993689130 1477618463 3055083741 1999750451 16646672...
result:
ok 5216 lines
Test #17:
score: 5
Accepted
time: 1026ms
memory: 35528kb
input:
50 10000 1 2 337289894 2 3 644529789 3 4 271847531 4 5 572013548 5 6 556451843 6 7 659023427 7 8 921127707 8 9 469405854 9 10 545997296 10 11 817609444 11 12 141992903 12 13 697921696 13 14 788063268 14 15 671026780 15 16 728175238 16 17 507914122 17 18 402265517 18 19 500627033 19 20 926252757 20 2...
output:
-19951921283710 -19824907952578 -19864270494458 -20016352146514 -19960666473367 -20014970487251 -19987572973190 -19433578048230 -19904335441647 -19973957506356 -19959015833098 -20010740988037 -20106992846250 -20061706975944 -19980712407983 -19980846575743 -19966561817887 -19903242332628 -19961317360...
result:
ok 50 lines
Test #18:
score: 5
Accepted
time: 1842ms
memory: 84320kb
input:
20 50000 1 2 947441270 2 3 347862603 3 4 841221721 4 5 602718715 5 6 314169232 6 7 271568187 7 8 103308599 8 9 518351012 9 10 403259816 10 11 525661932 11 12 906706009 12 13 359328898 13 14 329646222 14 15 944812671 15 16 933960085 16 17 894441828 17 18 353503858 18 19 871801328 19 20 653054815 20 2...
output:
-99873690164108 -100044427780399 -100210304805589 -100032486879657 -100718319990423 -100939786859772 -100159592665041 -99913461299722 -99908532546244 -99939791883760 -100174857403588 -100298472920888 -100154035678345 -100345671629004 -104056010699156 -100336685783077 -102144600258598 -99980679129186...
result:
ok 20 lines
Test #19:
score: 5
Accepted
time: 1479ms
memory: 82284kb
input:
15001 18 1 2 548047653 2 3 830498788 3 4 776376564 1 5 442376221 5 6 336814108 2 7 865914777 7 8 74368436 7 9 28482995 9 10 59424328 6 11 76912958 10 12 23054734 12 13 569994260 4 14 301620040 14 15 57874563 14 16 319603688 16 17 90481420 7 18 357607498 40 4 18 10432437242 2 15 9236050724 9 12 67389...
output:
-12970671591 -23241352317 -9808403356 -27271695204 -16054875604 -742765731 -9337868799 -16442064139 -27503303946 -28223798656 -36171934295 -3999115836821 -443344151 -8178261787 -7058941541 -2890049158 -10369732155 -2401898550 -12353169820 -27705609857 -21125607477 -16662785708 -23044284861 -12438811...
result:
ok 15001 lines
Test #20:
score: 5
Accepted
time: 1426ms
memory: 86976kb
input:
14747 30 1 2 108495240 2 3 946632342 2 4 508027435 2 5 418511391 5 6 624220595 6 7 820640967 6 8 998707796 7 9 323081330 5 10 553410529 2 11 846772199 11 12 313696368 12 13 234001588 10 14 964945212 8 15 102994086 7 16 515192862 16 17 115268583 16 18 954140216 17 19 880753105 19 20 149105203 3 21 12...
output:
-44205106286 -24333267068 -16722424628 -20539280728 -47757682662 -28299381509 -32875981754 -14853995236 953704371 -4008588342 -28376447539 -7252406257 -8897764448 -9120231406 -41873136798 -2736844590 -10238168542 -102264284 -51777143975 -31374237538 148209214 -25744383794 -26922609666 -6069731062 15...
result:
ok 14747 lines
Extra Test:
score: 0
Extra Test Passed