QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#614287#9443. Left Equals Rightucup-team3510#AC ✓41ms7944kbC++20719b2024-10-05 16:06:292024-10-05 16:06:30

Judging History

你现在查看的是最新测评结果

  • [2024-10-05 16:06:30]
  • 评测
  • 测评结果:AC
  • 用时:41ms
  • 内存:7944kb
  • [2024-10-05 16:06:29]
  • 提交

answer

#include <bits/stdc++.h>

using namespace std;
typedef long long ll;

const int N = 105, mod = 998244353;
int a[N], fac[N];
int f[N * N][N];

int main()
{
	int n, i, j, k, ans = 0, sum = 0;
	scanf("%d", &n);
	for(i = 1; i <= n; i++)
		scanf("%d", a + i);
	f[0][0] = 1;
	for(i = 1; i <= n; i++)
	{
		for(j = sum; j >= 0; j--)
			for(k = i; k >= 0; k--)
				f[j + a[i]][k + 1] = (f[j + a[i]][k + 1] + f[j][k]) % mod;
		sum += a[i];
	}
	fac[0] = 1;
	for(i = 1; i <= n; i++)
		fac[i] = (ll)fac[i - 1] * i % mod;
	if(sum & 1)
	{
		printf("0\n");
		return 0;
	}
	for(i = 0; i <= n; i++)
		ans = (ans + (ll)fac[i] * fac[n - i] % mod * f[sum / 2][i]) % mod;
	printf("%d\n", ans);
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 0ms
memory: 3880kb

input:

3
4 9 5

output:

4

result:

ok "4"

Test #2:

score: 0
Accepted
time: 0ms
memory: 3840kb

input:

2
100 100

output:

2

result:

ok "2"

Test #3:

score: 0
Accepted
time: 0ms
memory: 3824kb

input:

8
3 2 6 3 1 2 4 5

output:

11520

result:

ok "11520"

Test #4:

score: 0
Accepted
time: 0ms
memory: 3924kb

input:

2
93 93

output:

2

result:

ok "2"

Test #5:

score: 0
Accepted
time: 0ms
memory: 3772kb

input:

2
62 45

output:

0

result:

ok "0"

Test #6:

score: 0
Accepted
time: 0ms
memory: 3936kb

input:

3
32 68 36

output:

4

result:

ok "4"

Test #7:

score: 0
Accepted
time: 0ms
memory: 3896kb

input:

3
27 2 25

output:

4

result:

ok "4"

Test #8:

score: 0
Accepted
time: 1ms
memory: 4048kb

input:

10
38 27 36 88 77 25 73 44 11 21

output:

126720

result:

ok "126720"

Test #9:

score: 0
Accepted
time: 1ms
memory: 3912kb

input:

10
93 78 29 81 14 20 18 71 85 48

output:

0

result:

ok "0"

Test #10:

score: 0
Accepted
time: 0ms
memory: 4048kb

input:

9
57 19 88 13 55 43 27 10 74

output:

5760

result:

ok "5760"

Test #11:

score: 0
Accepted
time: 1ms
memory: 4000kb

input:

10
80 1 44 85 32 85 3 4 80 45

output:

0

result:

ok "0"

Test #12:

score: 0
Accepted
time: 1ms
memory: 4112kb

input:

10
56 72 93 39 70 78 3 10 84 48

output:

0

result:

ok "0"

Test #13:

score: 0
Accepted
time: 1ms
memory: 4072kb

input:

10
2 58 36 81 100 85 11 39 24 50

output:

118080

result:

ok "118080"

Test #14:

score: 0
Accepted
time: 0ms
memory: 4016kb

input:

10
70 23 3 26 98 18 63 32 22 25

output:

158400

result:

ok "158400"

Test #15:

score: 0
Accepted
time: 1ms
memory: 4004kb

input:

10
42 92 12 71 85 68 78 89 98 30

output:

0

result:

ok "0"

Test #16:

score: 0
Accepted
time: 1ms
memory: 3904kb

input:

10
26 5 25 35 77 46 81 13 73 32

output:

0

result:

ok "0"

Test #17:

score: 0
Accepted
time: 1ms
memory: 4004kb

input:

10
37 43 7 51 89 86 84 26 28 15

output:

103680

result:

ok "103680"

Test #18:

score: 0
Accepted
time: 6ms
memory: 5208kb

input:

58
84 96 24 20 3 10 27 57 98 49 32 52 67 18 100 6 100 4 4 88 24 77 75 95 18 83 58 75 71 99 18 53 68 65 76 37 51 19 65 63 28 59 84 59 80 73 83 41 96 30 96 5 13 56 92 84 30 72

output:

670239800

result:

ok "670239800"

Test #19:

score: 0
Accepted
time: 0ms
memory: 4736kb

input:

46
56 33 63 4 25 2 42 41 58 22 98 76 53 94 52 69 40 1 56 43 41 56 40 65 81 91 89 68 36 78 38 14 84 77 28 27 76 8 62 54 15 11 15 52 68 87

output:

0

result:

ok "0"

Test #20:

score: 0
Accepted
time: 5ms
memory: 4952kb

input:

55
55 49 60 49 90 95 61 61 9 5 81 63 6 70 52 64 14 87 18 87 35 19 97 20 70 11 73 48 69 19 55 23 3 73 34 68 45 30 66 37 97 75 71 8 42 91 15 63 86 63 92 48 11 53 3

output:

0

result:

ok "0"

Test #21:

score: 0
Accepted
time: 3ms
memory: 4736kb

input:

44
10 24 66 44 89 40 47 89 87 62 30 32 95 65 81 52 10 66 25 81 19 21 35 18 49 84 60 18 87 69 19 31 38 29 53 60 73 49 71 95 48 13 48 99

output:

0

result:

ok "0"

Test #22:

score: 0
Accepted
time: 6ms
memory: 5188kb

input:

61
39 96 26 73 57 39 47 84 15 54 33 83 52 37 66 66 99 21 29 17 51 74 38 43 71 83 41 86 38 96 12 55 77 70 47 76 28 78 15 40 41 4 12 62 91 5 50 87 71 42 15 67 91 88 54 31 67 90 2 15 50

output:

0

result:

ok "0"

Test #23:

score: 0
Accepted
time: 8ms
memory: 5320kb

input:

69
32 71 20 89 72 81 99 62 46 44 96 33 84 99 16 32 14 10 52 46 3 9 9 41 84 50 14 56 12 15 79 68 72 90 53 54 96 3 100 58 12 74 93 14 8 28 76 86 19 87 92 23 86 93 5 22 15 87 72 92 2 74 58 2 89 43 11 58 11

output:

297754781

result:

ok "297754781"

Test #24:

score: 0
Accepted
time: 4ms
memory: 4864kb

input:

54
50 84 44 63 83 28 48 97 13 75 41 70 2 6 35 95 6 61 77 93 56 84 32 5 83 51 82 71 39 35 38 96 48 35 89 52 49 4 5 50 55 53 86 92 3 17 9 76 9 54 1 67 74 21

output:

715843927

result:

ok "715843927"

Test #25:

score: 0
Accepted
time: 6ms
memory: 5096kb

input:

60
14 27 76 29 43 86 85 61 58 38 59 66 63 99 43 43 38 63 25 82 54 58 39 13 43 81 27 90 51 67 23 56 46 26 11 90 57 39 1 5 97 14 54 78 77 25 77 94 15 56 30 44 71 32 88 2 94 16 23 40

output:

959316858

result:

ok "959316858"

Test #26:

score: 0
Accepted
time: 0ms
memory: 5028kb

input:

56
62 53 6 12 17 99 84 81 68 95 67 68 9 38 11 9 68 100 6 57 37 68 16 27 48 98 26 73 64 60 19 3 98 31 79 34 22 41 24 25 60 3 60 16 75 48 45 78 73 10 89 75 72 71 78 23

output:

0

result:

ok "0"

Test #27:

score: 0
Accepted
time: 15ms
memory: 5892kb

input:

92
84 6 82 67 94 28 67 17 58 88 80 30 74 85 17 49 76 73 15 72 77 79 74 35 64 16 61 54 38 25 68 76 91 11 83 28 58 47 39 44 2 92 68 83 23 83 95 28 78 44 62 95 62 43 31 38 50 38 25 93 19 40 79 72 56 59 9 25 24 67 20 2 25 28 49 60 30 45 10 36 90 73 67 94 20 38 71 89 68 32 56 70

output:

338893764

result:

ok "338893764"

Test #28:

score: 0
Accepted
time: 1ms
memory: 3892kb

input:

100
4 2 4 2 3 4 2 4 2 1 3 1 2 1 2 2 3 2 1 2 1 2 1 2 4 4 4 1 3 2 2 2 3 1 2 3 4 1 2 3 3 2 1 1 3 3 3 1 2 2 1 2 1 3 4 3 3 2 2 4 4 1 2 3 3 4 4 1 4 2 3 4 4 2 3 3 2 2 3 2 3 1 4 1 3 2 3 4 2 2 1 1 2 2 1 3 2 3 4 2

output:

572766636

result:

ok "572766636"

Test #29:

score: 0
Accepted
time: 1ms
memory: 3916kb

input:

100
1 1 1 1 2 4 2 1 4 3 2 2 2 4 2 2 1 1 2 1 3 1 1 4 3 4 4 3 1 3 1 2 4 3 4 3 4 3 1 4 3 1 3 1 2 2 1 1 2 1 3 4 3 4 2 3 1 1 4 4 4 1 3 2 3 4 4 4 2 3 3 2 4 1 1 3 4 4 3 2 2 2 1 4 3 2 3 4 1 1 3 2 4 2 4 1 1 1 4 3

output:

165206805

result:

ok "165206805"

Test #30:

score: 0
Accepted
time: 0ms
memory: 4052kb

input:

100
2 4 1 3 4 2 2 4 1 2 4 3 1 1 4 1 4 1 4 3 2 4 3 2 2 4 4 4 3 2 1 1 1 4 3 1 4 4 1 3 3 1 4 4 3 2 2 1 3 3 4 1 1 4 3 1 2 4 1 2 1 4 4 4 1 3 1 3 2 1 3 2 3 2 2 2 2 4 4 3 3 4 1 4 4 4 3 4 3 1 2 2 2 2 2 4 1 3 3 2

output:

76147012

result:

ok "76147012"

Test #31:

score: 0
Accepted
time: 1ms
memory: 3896kb

input:

99
3 3 3 2 3 4 3 3 3 1 2 2 1 3 4 2 2 3 2 2 4 3 3 4 3 3 3 3 3 4 2 1 2 1 2 2 3 4 3 4 1 3 4 3 4 3 1 4 3 2 3 3 2 3 3 2 2 2 4 1 3 1 2 3 1 1 4 4 4 2 4 1 4 4 4 2 4 3 2 3 2 4 2 2 1 3 1 4 4 1 2 1 2 1 2 4 3 2 2

output:

366402822

result:

ok "366402822"

Test #32:

score: 0
Accepted
time: 1ms
memory: 3972kb

input:

99
3 1 4 1 1 1 4 4 2 1 2 3 4 2 3 1 4 2 1 2 2 4 3 3 3 1 2 4 3 3 1 1 1 1 2 4 1 4 3 3 1 1 4 2 3 4 3 3 2 2 4 4 4 1 1 1 1 1 3 3 3 1 4 4 1 4 1 1 4 1 3 1 4 1 1 3 2 4 3 2 1 1 1 4 3 4 2 3 3 4 1 2 1 2 3 4 3 1 2

output:

597470544

result:

ok "597470544"

Test #33:

score: 0
Accepted
time: 2ms
memory: 3980kb

input:

99
4 4 4 3 1 3 1 1 2 3 1 2 4 3 2 4 3 4 4 3 3 3 4 4 4 3 4 1 4 2 4 3 2 4 4 3 2 1 1 4 2 2 3 3 1 1 2 1 2 3 3 4 1 1 4 1 4 3 1 2 1 3 4 2 2 4 2 4 4 2 1 4 4 2 1 3 3 3 3 4 4 2 1 2 2 3 2 3 4 4 4 3 2 1 3 2 3 2 1

output:

302222618

result:

ok "302222618"

Test #34:

score: 0
Accepted
time: 22ms
memory: 5980kb

input:

99
90 96 38 36 93 81 38 52 90 17 58 25 29 28 63 33 67 32 59 87 71 88 8 10 80 66 50 38 59 7 86 91 37 82 68 70 75 14 60 67 24 16 42 29 19 61 8 72 53 13 84 98 69 23 80 85 77 88 13 78 50 81 79 57 3 29 19 17 36 4 18 58 28 49 23 77 5 2 71 24 90 57 99 42 21 27 40 18 73 55 25 7 59 79 27 63 85 56 20

output:

219088716

result:

ok "219088716"

Test #35:

score: 0
Accepted
time: 21ms
memory: 5984kb

input:

99
51 94 96 4 71 49 53 99 35 22 97 78 91 33 15 72 54 27 91 95 12 5 79 4 50 28 43 42 19 67 41 60 35 35 97 45 24 62 66 45 5 82 2 33 83 3 79 32 13 47 84 59 91 47 72 48 33 88 80 8 84 14 72 97 41 91 96 56 94 41 31 56 27 36 44 53 46 20 65 98 80 49 13 3 14 53 71 81 9 92 92 51 19 17 31 15 23 70 80

output:

918199689

result:

ok "918199689"

Test #36:

score: 0
Accepted
time: 15ms
memory: 5724kb

input:

99
33 61 30 2 85 2 27 35 64 47 53 94 63 87 58 47 75 35 88 45 100 45 45 33 52 10 26 91 3 48 9 94 68 39 20 45 65 33 31 8 97 12 10 93 44 2 9 62 43 100 98 2 50 61 31 63 5 43 39 55 4 71 9 73 76 14 33 59 36 81 20 60 34 35 61 53 4 34 94 32 97 47 3 46 26 24 7 43 68 44 73 11 83 26 85 53 38 99 73

output:

914166196

result:

ok "914166196"

Test #37:

score: 0
Accepted
time: 18ms
memory: 6004kb

input:

99
84 40 73 93 91 15 94 18 83 43 49 48 71 29 79 18 21 64 46 35 22 20 21 57 75 59 29 52 55 4 6 49 33 75 59 92 52 22 40 64 96 100 62 24 16 70 79 80 71 30 72 63 55 90 63 40 34 48 69 48 43 47 94 71 46 32 15 43 12 71 86 73 71 22 83 89 88 55 54 44 63 60 28 59 71 74 28 3 9 79 83 44 20 5 13 18 75 7 95

output:

0

result:

ok "0"

Test #38:

score: 0
Accepted
time: 13ms
memory: 5900kb

input:

99
54 36 52 35 13 33 92 99 77 54 76 3 21 92 84 72 20 60 35 22 6 20 25 89 85 61 33 15 31 16 65 81 79 93 26 54 28 97 16 14 4 5 77 58 42 15 94 21 31 50 45 15 72 38 86 96 34 28 21 54 37 82 100 50 53 66 67 1 13 23 57 27 11 57 72 8 30 97 38 2 14 47 45 98 48 24 100 86 64 37 87 82 74 89 29 94 76 25 39

output:

0

result:

ok "0"

Test #39:

score: 0
Accepted
time: 18ms
memory: 5668kb

input:

100
38 3 61 14 72 10 96 24 28 77 34 78 5 21 11 16 18 29 17 39 25 56 63 84 82 8 30 26 17 40 37 62 15 100 58 92 44 3 71 28 13 72 70 11 75 13 58 98 72 8 24 51 8 20 89 44 2 23 99 73 65 26 57 22 59 70 19 35 33 22 26 80 29 1 76 9 28 69 6 11 5 28 77 97 49 50 62 84 45 4 99 19 55 68 28 40 51 86 5 91

output:

0

result:

ok "0"

Test #40:

score: 0
Accepted
time: 16ms
memory: 5828kb

input:

100
12 11 4 4 75 79 94 99 26 48 38 96 98 62 70 81 50 24 53 47 12 46 34 71 42 89 55 14 9 59 75 17 11 99 11 4 23 23 30 68 35 20 67 15 57 98 65 33 18 36 93 81 49 4 4 53 33 4 68 2 35 81 12 11 43 55 92 60 60 56 29 99 82 48 92 54 1 39 14 71 33 3 94 84 31 15 99 72 28 30 85 35 26 67 59 34 49 11 66 82

output:

0

result:

ok "0"

Test #41:

score: 0
Accepted
time: 24ms
memory: 6128kb

input:

100
91 60 71 71 66 94 35 70 5 38 2 47 99 8 44 87 73 39 54 56 58 66 93 54 63 47 71 35 70 13 66 88 8 88 40 71 80 15 57 29 76 58 96 59 39 97 43 10 79 61 40 67 71 15 33 13 8 87 87 52 71 82 94 60 83 84 23 96 75 86 4 32 40 5 97 78 45 100 32 82 33 60 28 98 36 24 93 78 25 63 90 89 40 27 51 65 100 9 92 95

output:

858791620

result:

ok "858791620"

Test #42:

score: 0
Accepted
time: 23ms
memory: 6196kb

input:

100
52 38 75 88 35 46 11 73 78 34 82 69 24 72 52 88 99 57 94 10 26 61 10 95 49 8 83 61 88 20 44 97 52 9 70 55 48 63 60 84 96 21 43 13 39 30 39 94 53 36 86 13 45 25 89 5 100 91 95 49 82 2 30 86 82 26 9 48 23 35 71 97 66 90 82 65 4 32 48 45 98 91 46 93 58 35 42 25 28 27 94 45 60 1 77 83 74 37 62 47

output:

738427555

result:

ok "738427555"

Test #43:

score: 0
Accepted
time: 19ms
memory: 5936kb

input:

100
66 65 14 59 31 92 57 54 15 53 87 60 92 75 43 32 98 63 15 97 79 15 68 54 9 92 82 2 62 100 18 95 96 22 35 89 88 4 11 49 68 63 29 22 5 66 16 46 34 66 44 30 24 28 84 80 87 17 2 44 92 36 75 95 49 86 86 52 56 49 95 57 43 43 82 84 19 70 74 37 5 70 33 50 16 84 90 25 7 68 75 62 59 4 7 54 45 28 49 66

output:

699293570

result:

ok "699293570"

Test #44:

score: 0
Accepted
time: 0ms
memory: 3804kb

input:

100
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1

output:

35305197

result:

ok "35305197"

Test #45:

score: 0
Accepted
time: 15ms
memory: 5676kb

input:

99
33 47 61 23 17 22 65 2 57 75 32 72 54 20 59 21 5 53 31 51 50 3 62 44 66 82 71 75 74 72 78 43 34 6 64 30 17 4 48 85 52 49 36 41 79 68 44 45 39 63 63 70 16 84 24 84 18 14 12 28 15 67 37 34 76 46 5 14 60 10 13 80 81 8 58 73 27 84 26 40 19 56 42 7 55 75 11 35 25 83 19 81 38 8 77 69 9 29 59

output:

905104398

result:

ok "905104398"

Test #46:

score: 0
Accepted
time: 14ms
memory: 5684kb

input:

99
67 24 58 28 1 51 46 63 17 38 7 60 29 13 40 57 71 82 86 6 19 5 12 70 55 22 66 44 53 27 59 65 2 32 88 50 69 18 1 48 43 9 74 45 33 31 60 23 34 52 8 76 77 79 16 11 49 87 54 30 15 4 42 83 20 88 36 64 85 25 78 85 88 47 48 61 26 73 14 39 14 56 10 81 21 68 14 37 66 72 75 3 80 35 41 23 62 27 84

output:

312550131

result:

ok "312550131"

Test #47:

score: 0
Accepted
time: 16ms
memory: 5452kb

input:

100
25 26 19 32 5 3 24 55 35 58 76 43 17 29 77 5 43 73 45 21 65 4 7 62 37 54 37 44 14 21 63 49 66 14 53 50 13 57 41 63 6 17 27 23 9 11 12 77 60 1 42 46 52 56 8 8 30 18 9 63 48 22 10 36 77 52 79 78 70 34 37 51 69 72 33 75 59 62 74 47 68 31 14 16 61 71 28 38 39 64 20 23 23 9 2 7 40 67 35 15

output:

513464322

result:

ok "513464322"

Test #48:

score: 0
Accepted
time: 20ms
memory: 5780kb

input:

100
22 40 75 44 53 17 48 76 38 36 82 72 10 63 50 70 46 52 60 37 42 26 56 51 66 35 21 9 80 49 70 65 31 82 73 32 23 5 67 39 47 65 62 71 77 83 61 81 11 62 54 41 8 24 14 42 16 7 19 60 27 59 43 12 78 58 45 6 34 62 13 64 25 68 74 29 84 3 18 15 20 58 69 30 83 33 2 55 6 57 82 80 4 79 28 19 30 19 73 82

output:

294800349

result:

ok "294800349"

Test #49:

score: 0
Accepted
time: 35ms
memory: 7944kb

input:

100
100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 ...

output:

35305197

result:

ok "35305197"

Test #50:

score: 0
Accepted
time: 21ms
memory: 5944kb

input:

100
92 79 24 69 100 10 38 53 3 21 73 32 7 27 37 28 49 51 86 91 77 89 5 55 19 81 47 65 57 44 72 50 6 64 11 29 83 60 74 87 36 15 68 93 62 12 34 4 43 80 42 56 78 1 9 70 88 66 18 20 17 94 33 39 99 46 95 35 31 90 2 98 84 82 59 97 85 45 52 8 63 48 25 16 41 76 54 23 13 61 14 58 75 30 40 26 67 71 96 22

output:

854040496

result:

ok "854040496"

Test #51:

score: 0
Accepted
time: 38ms
memory: 7804kb

input:

100
100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 ...

output:

0

result:

ok "0"

Test #52:

score: 0
Accepted
time: 41ms
memory: 7728kb

input:

100
97 100 99 99 95 98 99 99 97 97 100 97 97 96 98 96 97 95 95 96 95 99 99 99 95 97 99 100 95 97 99 97 95 96 98 95 98 97 98 99 96 97 97 95 100 99 98 100 100 100 95 95 97 99 100 95 97 100 100 95 99 96 95 95 95 97 99 95 100 98 95 98 98 100 98 96 97 100 99 100 99 95 99 97 98 100 100 99 96 98 95 100 97 ...

output:

640494053

result:

ok "640494053"

Test #53:

score: 0
Accepted
time: 37ms
memory: 7768kb

input:

100
100 100 95 95 98 98 100 96 99 95 99 96 97 100 98 99 96 99 97 98 96 96 95 98 97 97 99 98 100 95 97 97 100 98 99 100 98 99 97 96 99 98 100 98 95 96 99 99 97 96 99 100 98 99 97 95 100 97 99 96 98 98 95 96 97 95 98 99 99 96 97 96 98 96 100 98 96 97 97 95 97 100 99 99 100 98 98 96 95 97 100 100 99 97...

output:

525329040

result:

ok "525329040"

Extra Test:

score: 0
Extra Test Passed