QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#245830 | #6623. Perfect Matchings | 0x4F5DA2 | AC ✓ | 60ms | 74688kb | C++14 | 3.3kb | 2023-11-10 13:06:00 | 2023-11-10 13:06:01 |
Judging History
answer
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <cstdlib>
#define LL long long
const int maxn = 2000;
const int mp = 998244353;
int n;
struct node{
int nxt;
int to;
}edge[maxn * 4 + 10];
int head[maxn * 2 + 10];
int top;
void AddEdge(int u, int v){
++top;
edge[top].nxt = head[u];
edge[top].to = v;
head[u] = top;
return ;
}
long long ans = 0;
long long f[maxn * 2 + 10][maxn + 10][2];
long long temp[maxn + 10][2];
int siz[maxn * 2 + 10];
void dfs(int x, int fa){
siz[x] = 1;
f[x][0][0] = 1;
f[x][0][1] = 0;
for(int i = head[x]; i; i = edge[i].nxt){
int y = edge[i].to;
if(y != fa){
dfs(y, x);
/*memset(temp, 0, sizeof(temp));
for(int i = 0; i <= siz[x] / 2; i++){
for(int j = 0; j <= siz[y] / 2; j++){
temp[i + j][0]=(temp[i + j][0] + f[x][i][0] * (f[y][j][0] + f[y][j][1]) % mp) % mp;
temp[i + j][1]=(temp[i + j][1] + f[x][i][1] * (f[y][j][0] + f[y][j][1]) % mp) % mp;
temp[i + j + 1][1]=(temp[i + j + 1][1] + f[x][i][0] * f[y][j][0] % mp) % mp;
}
}
for(int i = 0; i <= siz[x] / 2 + siz[y] / 2 + 1; i++){
f[x][i][0] = temp[i][0];
f[x][i][1] = temp[i][1];
}*/
int tp = siz[x] / 2;
siz[x] = siz[x] + siz[y];
for(int j = siz[x] / 2; j > 0; --j){
//k = 0
//f[x][j][0] = f[x][j][0] * (f[y][0][0] + f[y][0][1]) % mp;
//f[x][j][1] = f[x][j][1] * (f[y][0][0] + f[y][0][1]) % mp;
//if(1 <= j){
f[x][j][1] = (f[x][j][1] + f[x][j - 1][0] * f[y][0][0] % mp) % mp;
//}
//
int st = std::max(1, j - tp - 1);
for(int k = st; k <= siz[y] / 2; ++k){
if(k <= j){
f[x][j][0] = (f[x][j][0] + f[x][j - k][0] * ((f[y][k][0] + f[y][k][1]) % mp) % mp) % mp;
f[x][j][1] = (f[x][j][1] + f[x][j - k][1] * ((f[y][k][0] + f[y][k][1]) % mp) % mp) % mp;
}
if(k + 1 <= j){
f[x][j][1] = (f[x][j][1] + f[x][j - k - 1][0] * f[y][k][0] % mp) % mp;
}
if(k >= j)
break ;
}
}
}
}
return ;
}
long long ny[maxn * 2 + 10];
long long jc[maxn * 2 + 10];
long long jcny[maxn * 2 + 10];
long long pow_2[maxn * 2 + 10];
long long pow_2ny[maxn * 2 + 10];
long long fun(int cnt){
return (jc[cnt] * pow_2ny[cnt / 2] % mp) * jcny[cnt/2] % mp;
}
int main(){
//freopen("data.txt", "r", stdin);
scanf("%d", &n);
pow_2[0] = 1;
pow_2[1] = 2;
pow_2ny[0] = 1;
pow_2ny[1] = 499122177;
jc[0] = 1;
jc[1] = 1;
jcny[0] = 1;
jcny[1] = 1;
ny[0] = 0;
ny[1] = 1;
for(int i = 2; i <= 2 * n; ++i){
//inv[i] = (long long)(p - p / i) * inv[p % i] % p;
ny[i] = (mp - mp / i) * ny[mp % i] % mp;
pow_2[i] = pow_2[i - 1] * 2 % mp;
pow_2ny[i] = pow_2ny[i - 1] * ny[2] % mp;
jc[i] = jc[i - 1] * i % mp;
jcny[i] = jcny[i - 1] * ny[i] % mp;
}
//
/*for(int i = 1; i <= 2 * n; ++i){
if(pow_2[i] >
}*/
//pow_2ny[2] = ny[2];
int u, v;
for(int i = 1; i < 2 * n; ++i){
scanf("%d%d", &u, &v);
AddEdge(u, v);
AddEdge(v, u);
}
dfs(1, 0);
/*for(int i = 0; i <= siz[1] / 2; ++i){
printf("%lld %lld\n", f[1][i][0], f[1][i][1]);
}*/
for(int i = 0; i <= n; ++i){
if(i & 1)
ans = (ans - (f[1][i][1] + f[1][i][0]) * fun(2 * n - 2 * i) % mp + mp) % mp;
else
ans = (ans + (f[1][i][1] + f[1][i][0]) * fun(2 * n - 2 * i) % mp) % mp;
}
printf("%lld", ans);
return 0;
}
/*
7
1 2
1 3
2 4
2 5
3 6
3 7
*/
这程序好像有点Bug,我给组数据试试?
详细
Test #1:
score: 100
Accepted
time: 0ms
memory: 1560kb
input:
2 1 2 1 3 3 4
output:
1
result:
ok 1 number(s): "1"
Test #2:
score: 0
Accepted
time: 0ms
memory: 1640kb
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: 1676kb
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: 1720kb
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: 3648kb
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: 1628kb
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: 3588kb
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: 13ms
memory: 37572kb
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: 22ms
memory: 44156kb
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: 15ms
memory: 42492kb
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: 15ms
memory: 42456kb
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: 23ms
memory: 44584kb
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: 16ms
memory: 43056kb
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: 19ms
memory: 42708kb
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: 22ms
memory: 42480kb
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: 19ms
memory: 44252kb
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: 19ms
memory: 42536kb
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: 11ms
memory: 44468kb
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: 11ms
memory: 44852kb
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: 15ms
memory: 42764kb
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: 19ms
memory: 41160kb
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: 7ms
memory: 42524kb
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: 28ms
memory: 53140kb
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: 29ms
memory: 49904kb
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: 48708kb
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: 51288kb
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: 25ms
memory: 48880kb
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: 29ms
memory: 50236kb
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: 31ms
memory: 51988kb
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: 21ms
memory: 48456kb
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: 31ms
memory: 42928kb
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: 26ms
memory: 46812kb
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: 59ms
memory: 63472kb
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: 52ms
memory: 65864kb
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: 60ms
memory: 64460kb
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: 52ms
memory: 64280kb
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: 52ms
memory: 66060kb
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: 47ms
memory: 74688kb
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: 3ms
memory: 39036kb
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: 22ms
memory: 40404kb
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: 7ms
memory: 39068kb
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: 15ms
memory: 39268kb
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"