QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#749796#4900. 数列重排NineSuns10 18ms13464kbC++141.0kb2024-11-15 10:17:352024-11-15 10:17:42

Judging History

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

  • [2024-11-15 10:17:42]
  • 评测
  • 测评结果:10
  • 用时:18ms
  • 内存:13464kb
  • [2024-11-15 10:17:35]
  • 提交

answer

#include <bits/stdc++.h>
#define ll long long
#define pii pair <int, int>
#define fi first
#define se second
#define pb push_back
#define int long long

using namespace std;
mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());
const int N = 1e7+5, inf = 0x3f3f3f3f3f3f3f3f, mod = 998244353; 
int m, l, r, x, pr[N], n;   
string str; 

int sum (int n) { return n*(n+1)/2; }
int gets (int k, int c) {
	if (c == 0 && k) return inf; 
	if (c == 0) return 0; 
	return sum(k/c)*(c-k%c)+sum(k/c+1)*(k%c); 
}

void solve () {
	cin >> m >> l >> r >> x >> str; 
	n = m*x; 
	for (int i = 0;i < m;i++) {
		n += str[i]-'0'; 
		pr[i] = str[i] == '1' ? (i ? pr[i-1]+1 : 1) : 0; 
	}
	ll res = 1; 
	for (int i = 1;i <= m;i++) res = res*233%mod; 
	ll ans = sum(n); 
	for (int i = 1;i < m;i++) ans -= n-i+1; ans %= mod; 
	cout << ans*res%mod; 
}

signed main () {
//	ios::sync_with_stdio(0);
//	cin.tie(0); cout.tie(0);
	int T = 1; //cin >> T;
	while (T--) solve();
	return 0;
}
/*
3 0 3 3
101
*/

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 0
Wrong Answer

Test #1:

score: 0
Wrong Answer
time: 0ms
memory: 3696kb

input:

2 0 2 2
01

output:

542890

result:

wrong answer 1st numbers differ - expected: '541257', found: '542890'

Subtask #2:

score: 0
Skipped

Dependency #1:

0%

Subtask #3:

score: 0
Skipped

Dependency #2:

0%

Subtask #4:

score: 0
Wrong Answer

Test #14:

score: 0
Wrong Answer
time: 0ms
memory: 3740kb

input:

2 0 1 114514
10

output:

218508755

result:

wrong answer 1st numbers differ - expected: '934764137', found: '218508755'

Subtask #5:

score: 10
Accepted

Test #17:

score: 10
Accepted
time: 18ms
memory: 12184kb

input:

1000000 1000000 1000000 928
01100010010000000101111110001111011101111000011110100101011110011001001000011000110101101100111110000100101010111001111100010011100110000000111110110100001100000000011101100001010001010000010000001001000110011111010101111100001001110110010100000011000010010001111010011100...

output:

437299311

result:

ok 1 number(s): "437299311"

Test #18:

score: 10
Accepted
time: 0ms
memory: 3664kb

input:

100 100 100 10000000
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000

output:

119118463

result:

ok 1 number(s): "119118463"

Subtask #6:

score: 0
Wrong Answer

Test #19:

score: 0
Wrong Answer
time: 11ms
memory: 12532kb

input:

1000000 0 1000000 1
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

output:

619753819

result:

wrong answer 1st numbers differ - expected: '852768823', found: '619753819'

Subtask #7:

score: 0
Wrong Answer

Test #21:

score: 0
Wrong Answer
time: 11ms
memory: 13464kb

input:

1000000 0 9823 627
01110001011101001100010011100101001011000011011110001101010000000101010111110111110010010001110100101001111000111100011101111001000000100111000010010100010101110110111110100010101010001110111001100011010001111000101010000110010010101110101010111110110001110111111000001110000110011...

output:

717380957

result:

wrong answer 1st numbers differ - expected: '383638431', found: '717380957'

Subtask #8:

score: 0
Skipped

Dependency #1:

0%

Subtask #9:

score: 0
Skipped

Dependency #1:

0%