QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#703747 | #6623. Perfect Matchings | lmcg | AC ✓ | 46ms | 128284kb | C++20 | 1.2kb | 2024-11-02 18:24:39 | 2024-11-02 18:24:41 |
Judging History
answer
#include<cstdio>
#include<cstring>
#include<vector>
#define RI register int
#define CI const int&
using namespace std;
const int N=4005,mod=998244353;
int n,x,y,f[N][N][2],sz[N],g[N]; vector <int> v[N];
inline void DFS(CI now=1,CI fa=0)
{
f[now][0][0]=1; sz[now]=1;
for (auto to:v[now]) if (to!=fa)
{
DFS(to,now); RI i,j; static int tmp[N][2];
for (i=0;i<=sz[now]+sz[to];++i) tmp[i][0]=tmp[i][1]=0;
for (i=0;i<=sz[now]/2;++i) for (j=0;j<=sz[to]/2;++j)
{
(tmp[i+j][0]+=1LL*f[now][i][0]*(f[to][j][0]+f[to][j][1])%mod)%=mod;
(tmp[i+j][1]+=1LL*f[now][i][1]*(f[to][j][0]+f[to][j][1])%mod)%=mod;
(tmp[i+j+1][1]+=1LL*f[now][i][0]*f[to][j][0]%mod)%=mod;
}
for (sz[now]+=sz[to],i=0;i<=sz[now];++i)
f[now][i][0]=tmp[i][0],f[now][i][1]=tmp[i][1];
}
}
int main()
{
//freopen("L.in","r",stdin); freopen("L.out","w",stdout);
RI i; for (scanf("%d",&n),n*=2,i=1;i<n;++i)
scanf("%d%d",&x,&y),v[x].push_back(y),v[y].push_back(x);
for (g[1]=1,i=3;i<=n;i+=2) g[i]=1LL*g[i-2]*i%mod;
int ans=0; for (DFS(),i=0;i<n;++i)
{
int cur=1LL*(f[1][i][0]+f[1][i][1])*g[max(1,n-i*2-1)]%mod;
if (i&1) ans=(ans-cur+mod)%mod; else (ans+=cur)%=mod;
}
return printf("%d",ans),0;
}
这程序好像有点Bug,我给组数据试试?
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3780kb
input:
2 1 2 1 3 3 4
output:
1
result:
ok 1 number(s): "1"
Test #2:
score: 0
Accepted
time: 0ms
memory: 3920kb
input:
3 1 2 2 3 3 4 4 5 5 6
output:
5
result:
ok 1 number(s): "5"
Test #3:
score: 0
Accepted
time: 0ms
memory: 3920kb
input:
10 2 1 3 2 4 2 5 3 6 3 7 5 8 4 9 3 10 5 11 3 12 9 13 11 14 8 15 5 16 1 17 4 18 1 19 11 20 19
output:
223263378
result:
ok 1 number(s): "223263378"
Test #4:
score: 0
Accepted
time: 0ms
memory: 3956kb
input:
10 2 1 3 1 4 1 5 1 6 5 7 3 8 7 9 3 10 2 11 3 12 5 13 12 14 10 15 11 16 10 17 4 18 14 19 4 20 4
output:
225215244
result:
ok 1 number(s): "225215244"
Test #5:
score: 0
Accepted
time: 0ms
memory: 5896kb
input:
10 2 1 3 1 4 3 5 3 6 5 7 3 8 5 9 3 10 8 11 2 12 1 13 11 14 2 15 3 16 3 17 2 18 11 19 10 20 3
output:
210104685
result:
ok 1 number(s): "210104685"
Test #6:
score: 0
Accepted
time: 0ms
memory: 3960kb
input:
10 2 1 3 2 4 3 5 1 6 2 7 5 8 2 9 3 10 2 11 10 12 7 13 12 14 2 15 2 16 15 17 2 18 6 19 15 20 8
output:
211263144
result:
ok 1 number(s): "211263144"
Test #7:
score: 0
Accepted
time: 0ms
memory: 3952kb
input:
10 2 1 3 2 4 3 5 2 6 2 7 1 8 7 9 3 10 8 11 5 12 6 13 11 14 8 15 1 16 13 17 2 18 14 19 11 20 12
output:
226024809
result:
ok 1 number(s): "226024809"
Test #8:
score: 0
Accepted
time: 19ms
memory: 127448kb
input:
1977 2 1 3 1 4 1 5 4 6 4 7 1 8 3 9 5 10 2 11 3 12 2 13 3 14 2 15 9 16 9 17 2 18 17 19 5 20 16 21 2 22 2 23 15 24 16 25 22 26 14 27 6 28 4 29 24 30 25 31 28 32 15 33 27 34 32 35 24 36 10 37 18 38 15 39 33 40 3 41 27 42 3 43 35 44 15 45 11 46 19 47 21 48 4 49 28 50 6 51 3 52 14 53 14 54 14 55 25 56 18...
output:
337494603
result:
ok 1 number(s): "337494603"
Test #9:
score: 0
Accepted
time: 15ms
memory: 125344kb
input:
1921 2 1 3 2 4 2 5 2 6 1 7 4 8 6 9 3 10 5 11 10 12 5 13 8 14 13 15 9 16 11 17 10 18 10 19 7 20 19 21 14 22 1 23 4 24 6 25 7 26 9 27 15 28 6 29 28 30 10 31 17 32 9 33 21 34 1 35 20 36 5 37 5 38 5 39 10 40 17 41 25 42 24 43 39 44 12 45 34 46 16 47 4 48 8 49 47 50 38 51 29 52 4 53 43 54 10 55 15 56 26 ...
output:
850212664
result:
ok 1 number(s): "850212664"
Test #10:
score: 0
Accepted
time: 13ms
memory: 127112kb
input:
1946 2 1 3 1 4 2 5 2 6 5 7 1 8 2 9 1 10 8 11 4 12 9 13 6 14 9 15 11 16 15 17 3 18 4 19 18 20 16 21 9 22 16 23 10 24 6 25 18 26 15 27 17 28 18 29 24 30 27 31 5 32 5 33 14 34 4 35 28 36 27 37 27 38 26 39 15 40 28 41 17 42 39 43 1 44 9 45 28 46 32 47 38 48 10 49 16 50 6 51 8 52 7 53 15 54 16 55 10 56 9...
output:
148051811
result:
ok 1 number(s): "148051811"
Test #11:
score: 0
Accepted
time: 12ms
memory: 123304kb
input:
1921 2 1 3 2 4 1 5 3 6 4 7 6 8 6 9 6 10 2 11 2 12 9 13 7 14 7 15 4 16 10 17 12 18 3 19 8 20 7 21 9 22 17 23 17 24 1 25 12 26 25 27 24 28 7 29 8 30 18 31 2 32 30 33 9 34 7 35 15 36 22 37 22 38 1 39 22 40 37 41 31 42 21 43 18 44 5 45 12 46 11 47 43 48 25 49 2 50 37 51 3 52 38 53 29 54 6 55 50 56 23 57...
output:
280704181
result:
ok 1 number(s): "280704181"
Test #12:
score: 0
Accepted
time: 12ms
memory: 127468kb
input:
1976 2 1 3 2 4 2 5 1 6 2 7 5 8 1 9 3 10 6 11 2 12 1 13 4 14 7 15 13 16 2 17 4 18 10 19 16 20 12 21 1 22 2 23 2 24 1 25 5 26 22 27 9 28 21 29 5 30 24 31 12 32 26 33 2 34 14 35 13 36 2 37 9 38 5 39 35 40 39 41 22 42 20 43 8 44 4 45 11 46 42 47 36 48 37 49 6 50 6 51 17 52 28 53 5 54 41 55 3 56 19 57 36...
output:
627986542
result:
ok 1 number(s): "627986542"
Test #13:
score: 0
Accepted
time: 15ms
memory: 127360kb
input:
1999 2 1 3 2 4 3 5 2 6 4 7 2 8 4 9 1 10 9 11 8 12 9 13 10 14 1 15 7 16 3 17 12 18 17 19 14 20 16 21 5 22 3 23 13 24 2 25 23 26 21 27 23 28 22 29 16 30 7 31 15 32 20 33 27 34 9 35 20 36 25 37 31 38 3 39 13 40 39 41 29 42 25 43 19 44 41 45 5 46 23 47 14 48 25 49 38 50 10 51 1 52 50 53 38 54 37 55 21 5...
output:
927794050
result:
ok 1 number(s): "927794050"
Test #14:
score: 0
Accepted
time: 16ms
memory: 127240kb
input:
1976 2 1 3 1 4 2 5 3 6 2 7 6 8 1 9 7 10 8 11 8 12 4 13 3 14 12 15 8 16 13 17 5 18 8 19 4 20 7 21 5 22 11 23 8 24 4 25 3 26 18 27 26 28 22 29 13 30 18 31 20 32 16 33 20 34 19 35 18 36 20 37 10 38 29 39 17 40 17 41 35 42 19 43 30 44 40 45 40 46 10 47 14 48 28 49 9 50 27 51 45 52 24 53 12 54 27 55 18 5...
output:
685071441
result:
ok 1 number(s): "685071441"
Test #15:
score: 0
Accepted
time: 16ms
memory: 125088kb
input:
1921 2 1 3 1 4 1 5 4 6 5 7 1 8 4 9 4 10 6 11 3 12 5 13 1 14 7 15 3 16 5 17 14 18 3 19 10 20 10 21 5 22 17 23 20 24 15 25 20 26 22 27 1 28 23 29 17 30 4 31 20 32 10 33 13 34 20 35 5 36 35 37 13 38 28 39 33 40 11 41 35 42 40 43 33 44 35 45 22 46 34 47 17 48 22 49 11 50 45 51 23 52 7 53 9 54 9 55 25 56...
output:
632229124
result:
ok 1 number(s): "632229124"
Test #16:
score: 0
Accepted
time: 16ms
memory: 125208kb
input:
1943 2 1 3 2 4 1 5 1 6 5 7 3 8 6 9 2 10 9 11 9 12 11 13 2 14 6 15 11 16 9 17 7 18 3 19 4 20 2 21 1 22 18 23 13 24 14 25 14 26 18 27 13 28 9 29 21 30 10 31 19 32 6 33 6 34 18 35 18 36 30 37 26 38 26 39 19 40 36 41 1 42 33 43 9 44 34 45 13 46 14 47 46 48 1 49 28 50 27 51 18 52 16 53 29 54 35 55 30 56 ...
output:
175426091
result:
ok 1 number(s): "175426091"
Test #17:
score: 0
Accepted
time: 18ms
memory: 127020kb
input:
1951 2 1 3 2 4 3 5 3 6 1 7 3 8 3 9 7 10 8 11 7 12 3 13 7 14 1 15 5 16 14 17 1 18 5 19 12 20 6 21 8 22 4 23 12 24 5 25 1 26 1 27 14 28 24 29 25 30 1 31 1 32 31 33 1 34 19 35 26 36 17 37 13 38 10 39 7 40 28 41 32 42 21 43 34 44 32 45 44 46 1 47 46 48 2 49 15 50 44 51 34 52 19 53 6 54 25 55 18 56 35 57...
output:
620932394
result:
ok 1 number(s): "620932394"
Test #18:
score: 0
Accepted
time: 16ms
memory: 125300kb
input:
1943 2 1 3 2 4 1 5 4 6 4 7 4 8 6 9 5 10 2 11 4 12 6 13 9 14 13 15 6 16 15 17 9 18 4 19 7 20 10 21 12 22 5 23 16 24 5 25 3 26 25 27 5 28 26 29 8 30 18 31 28 32 27 33 26 34 23 35 4 36 5 37 4 38 22 39 8 40 30 41 39 42 15 43 9 44 29 45 43 46 33 47 8 48 42 49 1 50 13 51 12 52 12 53 3 54 7 55 25 56 46 57 ...
output:
990615942
result:
ok 1 number(s): "990615942"
Test #19:
score: 0
Accepted
time: 19ms
memory: 127424kb
input:
1998 2 1 3 2 4 1 5 4 6 4 7 5 8 1 9 3 10 7 11 1 12 6 13 11 14 1 15 8 16 7 17 2 18 12 19 14 20 14 21 4 22 19 23 8 24 13 25 14 26 22 27 26 28 27 29 5 30 2 31 7 32 21 33 19 34 32 35 28 36 6 37 26 38 12 39 27 40 29 41 13 42 36 43 6 44 28 45 28 46 40 47 1 48 20 49 35 50 31 51 5 52 40 53 24 54 2 55 44 56 5...
output:
814855336
result:
ok 1 number(s): "814855336"
Test #20:
score: 0
Accepted
time: 11ms
memory: 127336kb
input:
1962 2 1 3 2 4 2 5 2 6 5 7 6 8 5 9 1 10 5 11 6 12 8 13 4 14 6 15 1 16 13 17 11 18 14 19 2 20 6 21 16 22 19 23 3 24 2 25 8 26 1 27 8 28 5 29 9 30 12 31 3 32 17 33 13 34 30 35 30 36 1 37 23 38 10 39 16 40 17 41 13 42 29 43 10 44 25 45 27 46 45 47 22 48 13 49 5 50 48 51 50 52 37 53 42 54 32 55 18 56 40...
output:
935127715
result:
ok 1 number(s): "935127715"
Test #21:
score: 0
Accepted
time: 13ms
memory: 127340kb
input:
1994 2 1 3 1 4 3 5 3 6 5 7 1 8 1 9 7 10 4 11 1 12 10 13 6 14 8 15 10 16 5 17 4 18 15 19 10 20 14 21 11 22 6 23 19 24 23 25 17 26 24 27 21 28 20 29 13 30 27 31 6 32 11 33 7 34 3 35 30 36 24 37 2 38 28 39 9 40 33 41 11 42 24 43 21 44 24 45 1 46 20 47 40 48 38 49 23 50 30 51 16 52 37 53 42 54 44 55 47 ...
output:
610654989
result:
ok 1 number(s): "610654989"
Test #22:
score: 0
Accepted
time: 20ms
memory: 125312kb
input:
1942 2 1 3 1 4 2 5 4 6 5 7 2 8 5 9 4 10 7 11 3 12 10 13 4 14 8 15 4 16 12 17 12 18 7 19 11 20 13 21 8 22 13 23 6 24 1 25 11 26 10 27 11 28 5 29 17 30 2 31 3 32 6 33 32 34 33 35 15 36 12 37 4 38 26 39 29 40 19 41 10 42 11 43 10 44 18 45 5 46 32 47 23 48 31 49 26 50 48 51 11 52 46 53 46 54 24 55 37 56...
output:
329465487
result:
ok 1 number(s): "329465487"
Test #23:
score: 0
Accepted
time: 20ms
memory: 127392kb
input:
1961 2 1 3 1 4 1 5 1 6 1 7 1 8 1 9 1 10 1 11 1 12 1 13 1 14 1 15 1 16 1 17 1 18 1 19 1 20 1 21 1 22 1 23 1 24 1 25 1 26 1 27 1 28 1 29 1 30 1 31 1 32 1 33 1 34 1 35 1 36 1 37 1 38 1 39 1 40 1 41 1 42 1 43 1 44 1 45 1 46 1 47 1 48 1 49 1 50 1 51 1 52 1 53 1 54 1 55 1 56 1 57 1 58 1 59 1 60 1 61 1 62 ...
output:
866759945
result:
ok 1 number(s): "866759945"
Test #24:
score: 0
Accepted
time: 27ms
memory: 127280kb
input:
1973 2 1 3 1 4 1 5 1 6 1 7 1 8 1 9 1 10 1 11 1 12 1 13 1 14 1 15 1 16 1 17 1 18 1 19 1 20 1 21 1 22 1 23 1 24 1 25 1 26 1 27 1 28 1 29 1 30 1 31 1 32 1 33 1 34 1 35 1 36 1 37 1 38 1 39 1 40 1 41 1 42 1 43 1 44 1 45 1 46 1 47 1 48 1 49 1 50 1 51 1 52 1 53 1 54 1 55 1 56 1 57 1 58 1 59 1 60 1 61 1 62 ...
output:
392535484
result:
ok 1 number(s): "392535484"
Test #25:
score: 0
Accepted
time: 25ms
memory: 127396kb
input:
1960 2 1 3 1 4 1 5 1 6 1 7 1 8 1 9 1 10 1 11 1 12 1 13 1 14 1 15 1 16 1 17 1 18 1 19 1 20 1 21 1 22 1 23 1 24 1 25 1 26 1 27 1 28 1 29 1 30 1 31 1 32 1 33 1 34 1 35 1 36 1 37 1 38 1 39 1 40 1 41 1 42 1 43 1 44 1 45 1 46 1 47 1 48 1 49 1 50 1 51 1 52 1 53 1 54 1 55 1 56 1 57 1 58 1 59 1 60 1 61 1 62 ...
output:
301636689
result:
ok 1 number(s): "301636689"
Test #26:
score: 0
Accepted
time: 23ms
memory: 127336kb
input:
1972 2 1 3 1 4 1 5 1 6 1 7 1 8 1 9 1 10 1 11 1 12 1 13 1 14 1 15 1 16 1 17 1 18 1 19 1 20 1 21 1 22 1 23 1 24 1 25 1 26 1 27 1 28 1 29 1 30 1 31 1 32 1 33 1 34 1 35 1 36 1 37 1 38 1 39 1 40 1 41 1 42 1 43 1 44 1 45 1 46 1 47 1 48 1 49 1 50 1 51 1 52 1 53 1 54 1 55 1 56 1 57 1 58 1 59 1 60 1 61 1 62 ...
output:
318078958
result:
ok 1 number(s): "318078958"
Test #27:
score: 0
Accepted
time: 24ms
memory: 125052kb
input:
1917 2 1 3 1 4 1 5 1 6 1 7 1 8 1 9 1 10 1 11 1 12 1 13 1 14 1 15 1 16 1 17 1 18 1 19 1 20 1 21 1 22 1 23 1 24 1 25 1 26 1 27 1 28 1 29 1 30 1 31 1 32 1 33 1 34 1 35 1 36 1 37 1 38 1 39 1 40 1 41 1 42 1 43 1 44 1 45 1 46 1 47 1 48 1 49 1 50 1 51 1 52 1 53 1 54 1 55 1 56 1 57 1 58 1 59 1 60 1 61 1 62 ...
output:
965554124
result:
ok 1 number(s): "965554124"
Test #28:
score: 0
Accepted
time: 20ms
memory: 127924kb
input:
1983 2 1 3 2 4 3 5 4 6 5 7 6 8 7 9 8 10 9 11 10 12 11 13 12 14 13 15 14 16 15 17 16 18 17 19 18 20 19 21 20 22 21 23 22 24 23 25 24 26 25 27 26 28 27 29 28 30 29 31 30 32 31 33 32 34 33 35 34 36 35 37 36 38 37 39 38 40 39 41 40 42 41 43 42 44 43 45 44 46 45 47 46 48 47 49 48 50 49 51 50 52 51 53 52 ...
output:
883574023
result:
ok 1 number(s): "883574023"
Test #29:
score: 0
Accepted
time: 15ms
memory: 124232kb
input:
1916 2 1 3 2 4 3 5 4 6 5 7 6 8 7 9 8 10 9 11 10 12 6 13 12 14 13 15 14 16 15 17 16 18 17 19 18 20 19 21 20 22 21 23 22 24 23 25 24 26 25 27 26 28 27 29 28 30 29 31 30 32 31 33 32 34 33 35 34 36 35 37 36 38 37 39 38 40 39 41 40 42 41 43 42 44 43 45 44 46 45 47 46 48 47 49 48 50 49 51 50 52 51 53 52 5...
output:
551865782
result:
ok 1 number(s): "551865782"
Test #30:
score: 0
Accepted
time: 20ms
memory: 127776kb
input:
1972 2 1 3 2 4 3 5 4 6 5 7 6 8 7 9 8 10 9 11 10 12 11 13 12 14 13 15 14 16 15 17 16 18 17 19 18 20 19 21 20 22 21 23 22 24 23 25 24 26 25 27 26 28 27 29 28 30 29 31 30 32 31 33 32 34 33 35 34 36 35 37 36 38 37 39 38 40 39 41 40 42 41 43 42 44 43 45 44 46 45 47 46 48 47 49 48 50 49 51 50 52 51 53 52 ...
output:
927692142
result:
ok 1 number(s): "927692142"
Test #31:
score: 0
Accepted
time: 28ms
memory: 127956kb
input:
1995 2 1 3 2 4 3 5 4 6 5 7 6 8 7 9 8 10 9 11 10 12 11 13 12 14 13 15 14 16 15 17 16 18 17 19 18 20 19 21 20 22 21 23 22 24 23 25 24 26 25 27 26 28 27 29 28 30 29 31 30 32 31 33 32 34 33 35 34 36 35 37 36 38 37 39 38 40 39 41 40 42 41 43 42 44 43 45 44 46 45 47 46 48 47 49 48 50 49 51 50 52 51 53 52 ...
output:
594503734
result:
ok 1 number(s): "594503734"
Test #32:
score: 0
Accepted
time: 18ms
memory: 125480kb
input:
1935 2 1 3 2 4 3 5 4 6 5 7 6 8 7 9 8 10 9 11 10 12 11 13 12 14 13 15 14 16 15 17 16 18 17 19 18 20 19 21 20 22 21 23 22 24 23 25 24 26 25 27 26 28 27 29 28 30 29 31 30 32 31 33 32 34 33 35 34 36 35 37 36 38 37 39 38 40 39 41 40 42 41 43 42 44 43 45 44 46 11 47 46 48 17 49 48 50 49 51 50 52 51 53 52 ...
output:
365362230
result:
ok 1 number(s): "365362230"
Test #33:
score: 0
Accepted
time: 36ms
memory: 126544kb
input:
1927 2 1 3 2 4 3 5 4 6 5 7 6 8 7 9 8 10 9 11 9 12 10 13 12 14 12 15 14 16 15 17 15 18 17 19 18 20 19 21 19 22 21 23 21 24 22 25 24 26 24 27 26 28 26 29 28 30 29 31 30 32 31 33 31 34 32 35 34 36 34 37 36 38 36 39 37 40 38 41 40 42 41 43 42 44 42 45 43 46 45 47 46 48 47 49 48 50 48 51 50 52 50 53 52 5...
output:
499548808
result:
ok 1 number(s): "499548808"
Test #34:
score: 0
Accepted
time: 36ms
memory: 128284kb
input:
1983 2 1 3 1 4 2 5 3 6 5 7 5 8 6 9 7 10 9 11 10 12 10 13 12 14 13 15 13 16 15 17 15 18 17 19 18 20 18 21 20 22 20 23 21 24 23 25 24 26 25 27 25 28 27 29 27 30 28 31 30 32 30 33 31 34 33 35 34 36 34 37 36 38 37 39 38 40 38 41 40 42 41 43 42 44 42 45 44 46 45 47 46 48 46 49 48 50 48 51 49 52 51 53 51 ...
output:
375212163
result:
ok 1 number(s): "375212163"
Test #35:
score: 0
Accepted
time: 36ms
memory: 128008kb
input:
1946 2 1 3 1 4 3 5 3 6 5 7 6 8 6 9 7 10 8 11 10 12 11 13 11 14 13 15 14 16 14 17 15 18 16 19 17 20 19 21 19 22 20 23 21 24 22 25 23 26 25 27 25 28 26 29 27 30 28 31 30 32 30 33 31 34 32 35 33 36 34 37 35 38 37 39 38 40 38 41 40 42 40 43 41 44 42 45 43 46 44 47 46 48 46 49 48 50 48 51 49 52 50 53 51 ...
output:
457744121
result:
ok 1 number(s): "457744121"
Test #36:
score: 0
Accepted
time: 36ms
memory: 127464kb
input:
1945 2 1 3 2 4 2 5 4 6 4 7 6 8 6 9 7 10 8 11 9 12 11 13 12 14 12 15 13 16 15 17 16 18 17 19 17 20 19 21 19 22 21 23 22 24 23 25 24 26 24 27 26 28 26 29 27 30 28 31 29 32 30 33 32 34 32 35 33 36 34 37 36 38 36 39 38 40 38 41 39 42 41 43 41 44 42 45 44 46 45 47 45 48 47 49 48 50 48 51 50 52 51 53 52 5...
output:
602988658
result:
ok 1 number(s): "602988658"
Test #37:
score: 0
Accepted
time: 40ms
memory: 128244kb
input:
1994 2 1 3 2 4 2 5 3 6 5 7 5 8 6 9 7 10 9 11 9 12 11 13 12 14 13 15 14 16 14 17 15 18 17 19 17 20 18 21 19 22 20 23 22 24 22 25 23 26 24 27 25 28 26 29 27 30 29 31 29 32 31 33 32 34 32 35 34 36 34 37 35 38 36 39 38 40 38 41 39 42 40 43 42 44 43 45 43 46 45 47 45 48 47 49 48 50 48 51 49 52 51 53 51 5...
output:
676531640
result:
ok 1 number(s): "676531640"
Test #38:
score: 0
Accepted
time: 40ms
memory: 125548kb
input:
1901 2 1 3 2 4 3 5 4 6 5 7 6 8 7 9 8 10 9 11 10 12 11 13 12 14 13 15 14 16 15 17 16 18 17 19 18 20 19 21 20 22 21 23 22 24 23 25 24 26 25 27 26 28 27 29 28 30 29 31 30 32 31 33 32 34 33 35 34 36 35 37 36 38 37 39 38 40 39 41 40 42 41 43 42 44 43 45 44 46 45 47 46 48 47 49 48 50 49 51 50 52 51 53 52 ...
output:
129759647
result:
ok 1 number(s): "129759647"
Test #39:
score: 0
Accepted
time: 31ms
memory: 127104kb
input:
1957 2 1 3 1 4 1 5 1 6 1 7 1 8 1 9 1 10 1 11 1 12 1 13 1 14 1 15 1 16 1 17 1 18 1 19 1 20 1 21 1 22 1 23 1 24 1 25 1 26 1 27 1 28 1 29 1 30 1 31 1 32 1 33 1 34 1 35 1 36 1 37 1 38 1 39 1 40 1 41 1 42 1 43 1 44 1 45 1 46 1 47 1 48 1 49 1 50 1 51 1 52 1 53 1 54 1 55 1 56 1 57 1 58 1 59 1 60 1 61 1 62 ...
output:
0
result:
ok 1 number(s): "0"
Test #40:
score: 0
Accepted
time: 12ms
memory: 125144kb
input:
1912 2 1 3 1 4 2 5 2 6 3 7 3 8 4 9 4 10 5 11 5 12 6 13 6 14 7 15 7 16 8 17 8 18 9 19 9 20 10 21 10 22 11 23 11 24 12 25 12 26 13 27 13 28 14 29 14 30 15 31 15 32 16 33 16 34 17 35 17 36 18 37 18 38 19 39 19 40 20 41 20 42 21 43 21 44 22 45 22 46 23 47 23 48 24 49 24 50 25 51 25 52 26 53 26 54 27 55 ...
output:
681873059
result:
ok 1 number(s): "681873059"
Test #41:
score: 0
Accepted
time: 40ms
memory: 125240kb
input:
1956 2 1 3 1 4 1 5 1 6 1 7 1 8 1 9 1 10 1 11 1 12 1 13 1 14 1 15 1 16 1 17 1 18 1 19 1 20 1 21 1 22 1 23 1 24 1 25 1 26 1 27 1 28 1 29 1 30 1 31 1 32 11 33 1 34 1 35 1 36 1 37 1 38 1 39 1 40 1 41 1 42 1 43 1 44 1 45 1 46 1 47 1 48 1 49 1 50 1 51 1 52 1 53 1 54 5 55 1 56 1 57 1 58 1 59 1 60 1 61 1 62...
output:
790096995
result:
ok 1 number(s): "790096995"
Test #42:
score: 0
Accepted
time: 46ms
memory: 127092kb
input:
1968 2 1 3 1 4 1 5 1 6 1 7 1 8 1 9 1 10 1 11 1 12 1 13 1 14 1 15 1 16 1 17 1 18 1 19 1 20 1 21 1 22 1 23 1 24 1 25 1 26 1 27 1 28 1 29 1 30 1 31 1 32 1 33 1 34 1 35 1 36 1 37 1 38 1 39 1 40 1 41 1 42 1 43 1 44 1 45 1 46 1 47 1 48 1 49 1 50 1 51 1 52 1 53 1 54 1 55 1 56 1 57 1 58 1 59 1 60 1 61 1 62 ...
output:
635342408
result:
ok 1 number(s): "635342408"