QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#751695 | #5357. 芒果冰加了空气 | Acoipp | 40 | 20ms | 12180kb | C++14 | 1.4kb | 2024-11-15 20:11:50 | 2024-11-15 20:11:51 |
Judging History
answer
#include<bits/stdc++.h>
#define ll long long
#define N 5005
#define mod 1000000007
using namespace std;
inline char nc(){
static char buf[1000000],*p=buf,*q=buf;
return p==q&&(q=(p=buf)+fread(buf,1,1000000,stdin),p==q)?EOF:*p++;
}
inline ll read(){
ll res = 0,w = 1;
char c = nc();
while(c<'0'||c>'9')w=(c=='-'?-1:w),c=nc();
while(c<='9'&&c>='0')res=res*10+c-'0',c=nc();
return res*w;
}
char obuf[1<<21],*p3=obuf;
inline void pc(char c){
p3-obuf<=(1<<20)?(*p3++=c):(fwrite(obuf,p3-obuf,1,stdout),p3=obuf,*p3++=c);
}
inline void write(ll x){
if(x<0) pc('-'),x=-x;
if(x>9) write(x/10);
pc(x%10+'0');
}
vector<ll> op[N];
ll n,i,j,x,y,f[N][N],g[N],ans,C[N][N];
inline void dfs(ll x,ll fa){
for(ll i=0;i<op[x].size();i++) if(op[x][i]!=fa) dfs(op[x][i],x);
f[x][1] = 1;
for(ll i=0;i<op[x].size();i++){
if(op[x][i]==fa) continue;
for(ll j=1;j<=n;j++){
for(ll k=1;k<=n;k++){
for(ll l=j;l<=j+k;l++) g[l]=(g[l]+f[x][j]*f[op[x][i]][k]%mod*C[l-1][j-1])%mod;
}
}
for(ll j=1;j<=n;j++) f[x][j]=g[j],g[j]=0;
}
}
int main(){
n=read();
C[0][0]=1;
for(i=0;i<=n;i++){
for(j=0;j<=n;j++){
if(i) C[i][j]+=C[i-1][j];
if(i&&j) C[i][j]+=C[i-1][j-1];
if(C[i][j]>=mod) C[i][j]-=mod;
}
}
for(i=1;i<n;i++) x=read(),y=read(),op[x].push_back(y),op[y].push_back(x);
dfs(1,-1);
for(i=1;i<=n;i++) ans=(ans+f[1][i])%mod;
write(ans);
return fwrite(obuf,p3-obuf,1,stdout),0;
}
Details
Tip: Click on the bar to expand more detailed information
Subtask #1:
score: 5
Accepted
Test #1:
score: 5
Accepted
time: 1ms
memory: 9764kb
input:
10 1 2 2 3 3 4 5 4 6 4 7 4 8 4 9 4 10 4
output:
310862
result:
ok single line: '310862'
Test #2:
score: 5
Accepted
time: 0ms
memory: 9812kb
input:
10 1 2 1 3 2 4 2 5 3 6 3 7 4 8 4 9 8 10
output:
64804
result:
ok single line: '64804'
Test #3:
score: 5
Accepted
time: 1ms
memory: 9892kb
input:
10 1 2 1 3 3 4 3 5 3 6 4 7 3 8 4 9 4 10
output:
258182
result:
ok single line: '258182'
Test #4:
score: 5
Accepted
time: 1ms
memory: 9820kb
input:
10 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10
output:
16796
result:
ok single line: '16796'
Test #5:
score: 5
Accepted
time: 1ms
memory: 7844kb
input:
10 1 2 2 3 3 4 4 5 1 6 2 7 3 8 4 9 5 10
output:
78384
result:
ok single line: '78384'
Test #6:
score: 5
Accepted
time: 1ms
memory: 7784kb
input:
10 1 2 1 3 2 4 3 5 2 6 4 7 3 8 7 9 9 10
output:
38896
result:
ok single line: '38896'
Test #7:
score: 5
Accepted
time: 0ms
memory: 9832kb
input:
10 1 2 2 3 4 3 5 3 6 3 7 3 8 3 9 3 10 3
output:
609656
result:
ok single line: '609656'
Test #8:
score: 5
Accepted
time: 1ms
memory: 7852kb
input:
10 1 2 1 3 2 4 2 5 3 6 3 7 4 8 4 9 9 10
output:
64804
result:
ok single line: '64804'
Test #9:
score: 5
Accepted
time: 1ms
memory: 7716kb
input:
10 1 2 1 3 3 4 3 5 1 6 4 7 1 8 4 9 9 10
output:
118638
result:
ok single line: '118638'
Test #10:
score: 5
Accepted
time: 1ms
memory: 9932kb
input:
10 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 8 10
output:
22438
result:
ok single line: '22438'
Test #11:
score: 5
Accepted
time: 1ms
memory: 9816kb
input:
10 1 2 1 3 2 4 3 5 4 6 5 7 6 8 7 9 8 10
output:
16796
result:
ok single line: '16796'
Test #12:
score: 5
Accepted
time: 1ms
memory: 7776kb
input:
10 1 2 1 3 1 4 3 5 4 6 2 7 3 8 5 9 5 10
output:
82316
result:
ok single line: '82316'
Test #13:
score: 5
Accepted
time: 0ms
memory: 9752kb
input:
8 1 2 3 2 4 2 5 2 6 2 7 2 8 2
output:
13700
result:
ok single line: '13700'
Test #14:
score: 5
Accepted
time: 0ms
memory: 9740kb
input:
8 1 2 1 3 2 4 2 5 3 6 3 7 3 8
output:
3996
result:
ok single line: '3996'
Test #15:
score: 5
Accepted
time: 1ms
memory: 9752kb
input:
8 1 2 2 3 1 4 1 5 1 6 3 7 6 8
output:
3490
result:
ok single line: '3490'
Test #16:
score: 5
Accepted
time: 0ms
memory: 9764kb
input:
8 1 2 2 3 3 4 4 5 5 6 6 7 7 8
output:
1430
result:
ok single line: '1430'
Test #17:
score: 5
Accepted
time: 0ms
memory: 9824kb
input:
8 1 2 1 3 2 4 3 5 4 6 5 7 6 8
output:
1430
result:
ok single line: '1430'
Test #18:
score: 5
Accepted
time: 1ms
memory: 9768kb
input:
8 1 2 2 3 3 4 2 5 3 6 5 7 4 8
output:
3232
result:
ok single line: '3232'
Test #19:
score: 5
Accepted
time: 1ms
memory: 7840kb
input:
8 1 2 2 3 4 3 5 3 6 3 7 3 8 3
output:
8970
result:
ok single line: '8970'
Test #20:
score: 5
Accepted
time: 1ms
memory: 11876kb
input:
8 1 2 1 3 2 4 2 5 3 6 3 7 2 8
output:
3996
result:
ok single line: '3996'
Test #21:
score: 5
Accepted
time: 1ms
memory: 7824kb
input:
8 1 2 1 3 1 4 4 5 3 6 4 7 2 8
output:
3332
result:
ok single line: '3332'
Test #22:
score: 5
Accepted
time: 0ms
memory: 9884kb
input:
8 1 2 2 3 3 4 4 5 5 6 6 7 2 8
output:
1870
result:
ok single line: '1870'
Test #23:
score: 5
Accepted
time: 1ms
memory: 7772kb
input:
8 1 2 2 3 1 4 2 5 3 6 4 7 5 8
output:
2416
result:
ok single line: '2416'
Test #24:
score: 5
Accepted
time: 1ms
memory: 9796kb
input:
8 1 2 1 3 2 4 3 5 2 6 6 7 3 8
output:
2802
result:
ok single line: '2802'
Test #25:
score: 5
Accepted
time: 1ms
memory: 9848kb
input:
3 1 2 2 3
output:
5
result:
ok single line: '5'
Test #26:
score: 5
Accepted
time: 1ms
memory: 7836kb
input:
10 1 2 1 3 1 4 4 5 1 6 6 7 3 8 5 9 2 10
output:
78904
result:
ok single line: '78904'
Subtask #2:
score: 0
Time Limit Exceeded
Test #27:
score: 0
Time Limit Exceeded
input:
5000 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 11 11 12 12 13 13 14 14 15 15 16 16 17 17 18 18 19 19 20 20 21 21 22 22 23 23 24 24 25 25 26 26 27 27 28 28 29 29 30 30 31 31 32 32 33 33 34 34 35 35 36 36 37 37 38 38 39 39 40 40 41 41 42 42 43 43 44 44 45 45 46 46 47 47 48 48 49 49 50 50 51 51 52 52 53 ...
output:
result:
Subtask #3:
score: 10
Accepted
Dependency #1:
100%
Accepted
Test #37:
score: 10
Accepted
time: 2ms
memory: 9920kb
input:
20 1 2 2 3 3 4 1 5 3 6 5 7 5 8 8 9 7 10 10 11 9 12 12 13 10 14 11 15 13 16 16 17 17 18 18 19 16 20
output:
85351498
result:
ok single line: '85351498'
Test #38:
score: 10
Accepted
time: 0ms
memory: 9940kb
input:
20 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 1 10 2 11 3 12 4 13 5 14 6 15 7 16 8 17 9 18 10 19 11 20
output:
469047999
result:
ok single line: '469047999'
Test #39:
score: 10
Accepted
time: 2ms
memory: 9868kb
input:
20 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 1 20
output:
564120378
result:
ok single line: '564120378'
Test #40:
score: 10
Accepted
time: 1ms
memory: 7760kb
input:
20 1 2 2 3 3 4 4 5 2 6 1 7 3 8 2 9 9 10 3 11 10 12 6 13 2 14 5 15 14 16 7 17 11 18 2 19 4 20
output:
663766512
result:
ok single line: '663766512'
Test #41:
score: 10
Accepted
time: 1ms
memory: 9892kb
input:
20 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 12 20
output:
476848595
result:
ok single line: '476848595'
Test #42:
score: 10
Accepted
time: 1ms
memory: 9816kb
input:
20 1 2 2 3 3 4 4 5 5 6 6 7 7 8 9 8 10 8 11 8 12 8 13 8 14 8 15 8 16 8 17 8 18 8 19 8 20 8
output:
488457335
result:
ok single line: '488457335'
Test #43:
score: 10
Accepted
time: 0ms
memory: 9952kb
input:
20 1 2 2 3 2 4 2 5 4 6 4 7 3 8 6 9 8 10 9 11 7 12 12 13 13 14 13 15 12 16 16 17 15 18 14 19 17 20
output:
752198316
result:
ok single line: '752198316'
Test #44:
score: 10
Accepted
time: 0ms
memory: 7904kb
input:
20 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 1 11 2 12 3 13 4 14 5 15 6 16 7 17 8 18 9 19 10 20
output:
542252149
result:
ok single line: '542252149'
Test #45:
score: 10
Accepted
time: 1ms
memory: 7764kb
input:
20 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 6 20
output:
194863442
result:
ok single line: '194863442'
Test #46:
score: 10
Accepted
time: 1ms
memory: 9920kb
input:
20 1 2 2 3 1 4 2 5 2 6 5 7 7 8 8 9 7 10 7 11 2 12 3 13 1 14 3 15 12 16 1 17 11 18 3 19 3 20
output:
23651915
result:
ok single line: '23651915'
Test #47:
score: 10
Accepted
time: 1ms
memory: 7796kb
input:
20 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 3 20
output:
492545226
result:
ok single line: '492545226'
Test #48:
score: 10
Accepted
time: 1ms
memory: 9940kb
input:
20 1 2 2 3 3 4 4 5 5 6 6 7 8 7 9 7 10 7 11 7 12 7 13 7 14 7 15 7 16 7 17 7 18 7 19 7 20 7
output:
351974281
result:
ok single line: '351974281'
Test #49:
score: 10
Accepted
time: 1ms
memory: 9812kb
input:
20 1 2 1 3 2 4 1 5 2 6 2 7 4 8 4 9 5 10 9 11 10 12 9 13 12 14 13 15 11 16 14 17 13 18 16 19 18 20
output:
781206475
result:
ok single line: '781206475'
Test #50:
score: 10
Accepted
time: 0ms
memory: 7892kb
input:
20 1 2 2 3 3 4 4 5 5 6 6 7 7 8 1 9 2 10 3 11 4 12 5 13 6 14 7 15 8 16 9 17 10 18 11 19 12 20
output:
859563531
result:
ok single line: '859563531'
Test #51:
score: 10
Accepted
time: 0ms
memory: 7788kb
input:
20 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 15 20
output:
376484809
result:
ok single line: '376484809'
Test #52:
score: 10
Accepted
time: 1ms
memory: 9876kb
input:
20 1 2 1 3 1 4 1 5 2 6 6 7 4 8 2 9 9 10 3 11 6 12 3 13 2 14 12 15 4 16 10 17 10 18 15 19 3 20
output:
785968691
result:
ok single line: '785968691'
Test #53:
score: 10
Accepted
time: 1ms
memory: 9940kb
input:
20 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 7 20
output:
931047734
result:
ok single line: '931047734'
Test #54:
score: 10
Accepted
time: 1ms
memory: 9800kb
input:
20 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 11 10 12 10 13 10 14 10 15 10 16 10 17 10 18 10 19 10 20 10
output:
162400297
result:
ok single line: '162400297'
Test #55:
score: 10
Accepted
time: 1ms
memory: 9812kb
input:
20 1 2 1 3 1 4 1 5 2 6 4 7 4 8 5 9 7 10 6 11 11 12 9 13 9 14 14 15 15 16 13 17 13 18 14 19 17 20
output:
250839719
result:
ok single line: '250839719'
Test #56:
score: 10
Accepted
time: 1ms
memory: 7832kb
input:
20 1 2 2 3 3 4 4 5 5 6 6 7 1 8 2 9 3 10 4 11 5 12 6 13 7 14 8 15 9 16 10 17 11 18 12 19 13 20
output:
219471148
result:
ok single line: '219471148'
Test #57:
score: 10
Accepted
time: 1ms
memory: 7800kb
input:
20 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 14 20
output:
194863442
result:
ok single line: '194863442'
Test #58:
score: 10
Accepted
time: 1ms
memory: 9908kb
input:
20 1 2 1 3 2 4 4 5 2 6 4 7 5 8 8 9 2 10 2 11 6 12 8 13 4 14 1 15 5 16 11 17 12 18 4 19 1 20
output:
493588236
result:
ok single line: '493588236'
Test #59:
score: 10
Accepted
time: 1ms
memory: 7824kb
input:
20 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 19 20
output:
399365910
result:
ok single line: '399365910'
Test #60:
score: 10
Accepted
time: 0ms
memory: 7752kb
input:
20 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 10 9 11 9 12 9 13 9 14 9 15 9 16 9 17 9 18 9 19 9 20 9
output:
24503169
result:
ok single line: '24503169'
Subtask #4:
score: 25
Accepted
Dependency #3:
100%
Accepted
Test #61:
score: 25
Accepted
time: 13ms
memory: 12168kb
input:
57 1 2 2 3 3 4 4 5 5 6 2 7 3 8 4 9 6 10 8 11 7 12 8 13 10 14 13 15 12 16 13 17 13 18 14 19 16 20 16 21 21 22 20 23 22 24 20 25 24 26 25 27 27 28 26 29 25 30 28 31 28 32 32 33 30 34 34 35 35 36 32 37 36 38 36 39 36 40 36 41 38 42 39 43 39 44 41 45 44 46 43 47 46 48 46 49 45 50 48 51 50 52 48 53 53 54...
output:
207339010
result:
ok single line: '207339010'
Test #62:
score: 25
Accepted
time: 13ms
memory: 9988kb
input:
57 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 1 27 2 28 3 29 4 30 5 31 6 32 7 33 8 34 9 35 10 36 11 37 12 38 13 39 14 40 15 41 16 42 17 43 18 44 19 45 20 46 21 47 22 48 23 49 24 50 25 51 26 52 27 53 28 54 29 55...
output:
444163693
result:
ok single line: '444163693'
Test #63:
score: 25
Accepted
time: 14ms
memory: 8120kb
input:
57 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 11 11 12 12 13 13 14 14 15 15 16 16 17 17 18 18 19 19 20 20 21 21 22 22 23 23 24 24 25 25 26 26 27 27 28 28 29 29 30 30 31 31 32 32 33 33 34 34 35 35 36 36 37 37 38 38 39 39 40 40 41 41 42 42 43 43 44 44 45 45 46 46 47 47 48 48 49 49 50 50 51 51 52 52 53 53...
output:
253999939
result:
ok single line: '253999939'
Test #64:
score: 25
Accepted
time: 16ms
memory: 8108kb
input:
57 1 2 1 3 3 4 2 5 5 6 4 7 3 8 1 9 7 10 7 11 8 12 9 13 7 14 14 15 8 16 11 17 2 18 3 19 1 20 17 21 12 22 17 23 9 24 12 25 19 26 19 27 15 28 3 29 22 30 11 31 11 32 14 33 19 34 18 35 16 36 18 37 19 38 6 39 33 40 6 41 12 42 35 43 43 44 42 45 21 46 31 47 10 48 46 49 11 50 4 51 12 52 17 53 8 54 46 55 39 5...
output:
404981769
result:
ok single line: '404981769'
Test #65:
score: 25
Accepted
time: 13ms
memory: 9972kb
input:
57 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 27 54 27 55...
output:
454043074
result:
ok single line: '454043074'
Test #66:
score: 25
Accepted
time: 14ms
memory: 12132kb
input:
57 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 28 27 29 27 30 27 31 27 32 27 33 27 34 27 35 27 36 27 37 27 38 27 39 27 40 27 41 27 42 27 43 27 44 27 45 27 46 27 47 27 48 27 49 27 50 27 51 27 52 27 53 27 54...
output:
832905030
result:
ok single line: '832905030'
Test #67:
score: 25
Accepted
time: 17ms
memory: 10092kb
input:
57 1 2 1 3 3 4 3 5 4 6 2 7 5 8 6 9 5 10 9 11 11 12 10 13 9 14 10 15 15 16 12 17 16 18 16 19 16 20 17 21 19 22 20 23 23 24 21 25 23 26 25 27 25 28 24 29 25 30 26 31 30 32 30 33 33 34 32 35 33 36 35 37 36 38 37 39 39 40 36 41 40 42 41 43 40 44 41 45 41 46 43 47 45 48 47 49 46 50 49 51 49 52 48 53 51 5...
output:
805899378
result:
ok single line: '805899378'
Test #68:
score: 25
Accepted
time: 17ms
memory: 10056kb
input:
57 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 1 29 2 30 3 31 4 32 5 33 6 34 7 35 8 36 9 37 10 38 11 39 12 40 13 41 14 42 15 43 16 44 17 45 18 46 19 47 20 48 21 49 22 50 23 51 24 52 25 53 26 54 27 55...
output:
705490172
result:
ok single line: '705490172'
Test #69:
score: 25
Accepted
time: 16ms
memory: 7968kb
input:
57 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 11 11 12 12 13 13 14 14 15 15 16 16 17 17 18 18 19 19 20 20 21 21 22 22 23 23 24 24 25 25 26 26 27 27 28 28 29 29 30 30 31 31 32 32 33 33 34 34 35 35 36 36 37 37 38 38 39 39 40 40 41 41 42 42 43 43 44 44 45 45 46 46 47 47 48 48 49 49 50 50 51 51 52 52 53 53...
output:
634401149
result:
ok single line: '634401149'
Test #70:
score: 25
Accepted
time: 13ms
memory: 12028kb
input:
57 1 2 2 3 2 4 1 5 5 6 4 7 2 8 8 9 5 10 3 11 2 12 7 13 3 14 7 15 8 16 7 17 12 18 4 19 9 20 5 21 2 22 21 23 10 24 22 25 12 26 12 27 9 28 7 29 8 30 3 31 15 32 7 33 3 34 23 35 7 36 22 37 23 38 21 39 22 40 36 41 4 42 30 43 5 44 36 45 26 46 39 47 37 48 17 49 34 50 23 51 33 52 41 53 18 54 38 55 12 56 38 57
output:
269904773
result:
ok single line: '269904773'
Test #71:
score: 25
Accepted
time: 16ms
memory: 12148kb
input:
57 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 27 54 27 55...
output:
310957820
result:
ok single line: '310957820'
Test #72:
score: 25
Accepted
time: 13ms
memory: 8076kb
input:
57 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 30 29 31 29 32 29 33 29 34 29 35 29 36 29 37 29 38 29 39 29 40 29 41 29 42 29 43 29 44 29 45 29 46 29 47 29 48 29 49 29 50 29 51 29 52 29 53 29 54...
output:
529454602
result:
ok single line: '529454602'
Test #73:
score: 25
Accepted
time: 16ms
memory: 12072kb
input:
60 1 2 1 3 2 4 4 5 2 6 2 7 3 8 5 9 8 10 6 11 10 12 12 13 12 14 11 15 13 16 12 17 16 18 15 19 18 20 19 21 18 22 22 23 22 24 20 25 25 26 25 27 27 28 25 29 26 30 30 31 29 32 32 33 33 34 34 35 35 36 34 37 34 38 34 39 36 40 39 41 38 42 40 43 42 44 44 45 43 46 43 47 47 48 44 49 49 50 46 51 49 52 49 53 53 ...
output:
742352534
result:
ok single line: '742352534'
Test #74:
score: 25
Accepted
time: 16ms
memory: 8084kb
input:
60 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 1 29 2 30 3 31 4 32 5 33 6 34 7 35 8 36 9 37 10 38 11 39 12 40 13 41 14 42 15 43 16 44 17 45 18 46 19 47 20 48 21 49 22 50 23 51 24 52 25 53 26 54 27 55...
output:
570704962
result:
ok single line: '570704962'
Test #75:
score: 25
Accepted
time: 16ms
memory: 8016kb
input:
60 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 11 11 12 12 13 13 14 14 15 15 16 16 17 17 18 18 19 19 20 20 21 21 22 22 23 23 24 24 25 25 26 26 27 27 28 28 29 29 30 30 31 31 32 32 33 33 34 34 35 35 36 36 37 37 38 38 39 39 40 40 41 41 42 42 43 43 44 44 45 45 46 46 47 47 48 48 49 49 50 50 51 51 52 52 53 53...
output:
767444667
result:
ok single line: '767444667'
Test #76:
score: 25
Accepted
time: 16ms
memory: 12032kb
input:
60 1 2 2 3 2 4 2 5 4 6 1 7 1 8 3 9 7 10 10 11 10 12 3 13 8 14 6 15 7 16 6 17 17 18 10 19 1 20 16 21 19 22 10 23 10 24 7 25 6 26 23 27 20 28 24 29 22 30 12 31 27 32 10 33 15 34 7 35 34 36 6 37 35 38 10 39 10 40 23 41 2 42 14 43 22 44 5 45 43 46 43 47 39 48 22 49 33 50 5 51 37 52 47 53 6 54 42 55 22 5...
output:
735270809
result:
ok single line: '735270809'
Test #77:
score: 25
Accepted
time: 16ms
memory: 12180kb
input:
60 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 27 54 27 55...
output:
859967454
result:
ok single line: '859967454'
Test #78:
score: 25
Accepted
time: 20ms
memory: 12156kb
input:
60 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 31 30 32 30 33 30 34 30 35 30 36 30 37 30 38 30 39 30 40 30 41 30 42 30 43 30 44 30 45 30 46 30 47 30 48 30 49 30 50 30 51 30 52 30 53 30 54...
output:
707392314
result:
ok single line: '707392314'
Test #79:
score: 25
Accepted
time: 20ms
memory: 8072kb
input:
60 1 2 2 3 2 4 2 5 2 6 3 7 7 8 5 9 7 10 8 11 10 12 11 13 10 14 12 15 13 16 12 17 16 18 18 19 16 20 17 21 20 22 21 23 22 24 23 25 23 26 24 27 27 28 24 29 29 30 26 31 27 32 32 33 29 34 33 35 34 36 34 37 34 38 36 39 36 40 37 41 40 42 39 43 41 44 42 45 42 46 43 47 46 48 44 49 46 50 50 51 50 52 52 53 49 ...
output:
552215869
result:
ok single line: '552215869'
Test #80:
score: 25
Accepted
time: 20ms
memory: 12064kb
input:
60 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 1 30 2 31 3 32 4 33 5 34 6 35 7 36 8 37 9 38 10 39 11 40 12 41 13 42 14 43 15 44 16 45 17 46 18 47 19 48 20 49 21 50 22 51 23 52 24 53 25 54 26 55...
output:
214555805
result:
ok single line: '214555805'
Test #81:
score: 25
Accepted
time: 20ms
memory: 8092kb
input:
60 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 11 11 12 12 13 13 14 14 15 15 16 16 17 17 18 18 19 19 20 20 21 21 22 22 23 23 24 24 25 25 26 26 27 27 28 28 29 29 30 30 31 31 32 32 33 33 34 34 35 35 36 36 37 37 38 38 39 39 40 40 41 41 42 42 43 43 44 44 45 45 46 46 47 47 48 48 49 49 50 50 51 51 52 52 53 53...
output:
11910602
result:
ok single line: '11910602'
Test #82:
score: 25
Accepted
time: 20ms
memory: 12112kb
input:
60 1 2 1 3 2 4 3 5 5 6 4 7 6 8 7 9 3 10 1 11 1 12 9 13 12 14 12 15 14 16 11 17 3 18 9 19 6 20 2 21 9 22 15 23 12 24 8 25 19 26 22 27 19 28 27 29 11 30 27 31 31 32 19 33 20 34 18 35 2 36 23 37 30 38 25 39 11 40 40 41 16 42 12 43 23 44 38 45 25 46 5 47 2 48 26 49 4 50 38 51 49 52 51 53 4 54 10 55 32 5...
output:
234907268
result:
ok single line: '234907268'
Test #83:
score: 25
Accepted
time: 20ms
memory: 10072kb
input:
60 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 27 54 27 55...
output:
206263445
result:
ok single line: '206263445'
Test #84:
score: 25
Accepted
time: 20ms
memory: 8140kb
input:
60 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 29 28 30 28 31 28 32 28 33 28 34 28 35 28 36 28 37 28 38 28 39 28 40 28 41 28 42 28 43 28 44 28 45 28 46 28 47 28 48 28 49 28 50 28 51 28 52 28 53 28 54...
output:
731555292
result:
ok single line: '731555292'
Subtask #5:
score: 0
Time Limit Exceeded
Dependency #4:
100%
Accepted
Test #85:
score: 0
Time Limit Exceeded
input:
398 1 2 1 3 1 4 2 5 1 6 6 7 5 8 7 9 7 10 8 11 11 12 10 13 13 14 14 15 15 16 13 17 13 18 16 19 17 20 17 21 19 22 22 23 20 24 23 25 25 26 24 27 27 28 27 29 27 30 30 31 31 32 30 33 31 34 32 35 31 36 36 37 36 38 35 39 37 40 37 41 41 42 38 43 40 44 44 45 45 46 45 47 47 48 48 49 49 50 46 51 47 52 49 53 51...
output:
result:
Subtask #6:
score: 0
Skipped
Dependency #5:
0%