QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#465140#8833. Equalizer Ehrmantrautucup-team2172#AC ✓345ms3948kbC++141.3kb2024-07-06 17:36:352024-07-06 17:36:35

Judging History

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

  • [2024-07-06 17:36:35]
  • 评测
  • 测评结果:AC
  • 用时:345ms
  • 内存:3948kb
  • [2024-07-06 17:36:35]
  • 提交

answer

#include <bits/stdc++.h>

using namespace std;

const int INF = 998244353;
const int maxn = 1e6 + 5;

inline int qpow(int x, int y) {
	int ret = 1;
	for (; y; y >>= 1) {
		// printf("y = %d\n", y);
		if (y & 1) ret = 1ll * ret * x % INF;
		x = 1ll * x * x % INF;
	}
	return ret;
}

int n, m;

int main(){
	scanf("%d%d", &n, &m);
	int ans = 0;
	
	int shit = 0, shit2 = 0;
	
	for (int y = 1; y <= m; ++y) {
		ans = (ans + 2ll * (qpow(m, n) + INF - qpow(m - y, n))) % INF;
	}
	
	
	/*
	for (int k = 0; k <= n; ++k) {
		int tot = 0;
		for (int x = 1; x <= m; ++x) {
			int sum = 0, res = 0;
			res = (qpow(x, k) + INF - qpow(x - 1, k)) % INF;
			for (int y = x; y <= m; ++y) {
				(sum += qpow(m - y, n - k)) %= INF;
			}
			sum = 2ll * sum % INF;
			printf("k = %d x = %d sum = %d\n", k, x, sum);
			tot = (tot + 1ll * res * sum) % INF;
		}
		printf("k = %d tot = %d\n", k, tot);
		ans = (ans + 1ll * binom(n, k) * tot) % INF;
	}
	*/
	
	
	for (int x = 1; x <= m; ++x) {
		int res = (2ll * (m - x) + 1) * (qpow(x, n) + INF - qpow(x - 1, n)) % INF;
		shit2 = (shit2 + INF - res) % INF;
	}
	ans = (ans + shit2) % INF;
	
	for (int y = 1; y <= m; ++y) ans = (ans + 2ll * qpow(m - y, n)) % INF;
	
	
	// printf("shit = %d shit2 = %d\n", shit, shit2);
	
	printf("%d\n", ans);
	return 0;
}

这程序好像有点Bug,我给组数据试试?

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

1 3

output:

9

result:

ok 1 number(s): "9"

Test #2:

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

input:

2 2

output:

10

result:

ok 1 number(s): "10"

Test #3:

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

input:

69 42

output:

608932821

result:

ok 1 number(s): "608932821"

Test #4:

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

input:

102 156

output:

748401290

result:

ok 1 number(s): "748401290"

Test #5:

score: 0
Accepted
time: 17ms
memory: 3876kb

input:

4646 95641

output:

89806680

result:

ok 1 number(s): "89806680"

Test #6:

score: 0
Accepted
time: 54ms
memory: 3748kb

input:

42849 215151

output:

242217237

result:

ok 1 number(s): "242217237"

Test #7:

score: 0
Accepted
time: 282ms
memory: 3796kb

input:

786416 794116

output:

472898000

result:

ok 1 number(s): "472898000"

Test #8:

score: 0
Accepted
time: 277ms
memory: 3868kb

input:

963852 789456

output:

353211048

result:

ok 1 number(s): "353211048"

Test #9:

score: 0
Accepted
time: 144ms
memory: 3868kb

input:

696969 424242

output:

787990158

result:

ok 1 number(s): "787990158"

Test #10:

score: 0
Accepted
time: 44ms
memory: 3864kb

input:

1000000 123456

output:

533491028

result:

ok 1 number(s): "533491028"

Test #11:

score: 0
Accepted
time: 345ms
memory: 3752kb

input:

1000000 1000000

output:

572586375

result:

ok 1 number(s): "572586375"

Test #12:

score: 0
Accepted
time: 286ms
memory: 3860kb

input:

123456 1000000

output:

486967129

result:

ok 1 number(s): "486967129"

Test #13:

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

input:

789456 1

output:

1

result:

ok 1 number(s): "1"

Test #14:

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

input:

852516 2

output:

148946358

result:

ok 1 number(s): "148946358"

Test #15:

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

input:

1 953646

output:

40087733

result:

ok 1 number(s): "40087733"

Test #16:

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

input:

3 7686

output:

278212472

result:

ok 1 number(s): "278212472"

Extra Test:

score: 0
Extra Test Passed