Submission details
Task:Bittijono
Sender:sandyy
Submission time:2026-01-17 14:35:59 +0200
Language:C++ (C++17)
Status:READY
Result:0
Feedback
groupverdictscore
#10
#20
#30
Test results
testverdicttimegroup
#10.00 s1, 3details
#20.00 s1, 2, 3details
#30.00 s1, 3details
#40.00 s1, 3details
#50.00 s1, 3details
#60.01 s3details
#70.01 s2, 3details
#80.01 s3details
#90.01 s2, 3details
#100.01 s2, 3details
#110.01 s3details
#120.01 s2, 3details
#130.01 s3details
#140.01 s3details
#150.01 s3details
#16ACCEPTED0.00 s1, 2, 3details
#170.00 s1, 3details
#180.00 s1, 3details
#190.01 s3details
#200.01 s3details

Code

#include<bits/stdc++.h>
using namespace std;

#define ll long long
#define ar array


int n;
ll a, b;
string s[2];

ll cost(ll l) {
	return min(l*a, b);
}

int main() {
	cin >> n >> a >> b >> s[0] >> s[1];
	vector<bool> act(n, 0);
	for(int i=0; i<n; i++) {
		if(s[0][i]!=s[1][i]) {
			act[i]=1;
		}
	}
	act.push_back(0);
	vector<ar<int, 2>> segs;
	int l=0;
	for(int i=1; i<=n; i++) {
		if(!act[i] && act[i-1]) {
			segs.push_back({l, i});
		}
		if(act[i] && !act[i-1]) {
			l=i;
		}
	}
	if(segs.empty()) {
		cout << 0;
		return 0;
	}
	//for(ar<int, 2> se:segs) {
		//cout << se[0] << " " << se[1] << "\n";
	//}
	int m=segs.size();
	vector<ll> dp(m);
	dp[0]=cost(segs[0][1]-segs[0][0]);
	cout << dp[0] << " ";
	for(int i=1; i<m; i++) {
		dp[i]=min(dp[i-1]+cost(segs[i][1]-segs[i][0]), dp[i-1]+cost(segs[i][0]-segs[i-1][1]));
		cout << dp[i] << " ";
	}
}

Test details

Test 1 (public)

Group: 1, 3

Verdict:

input
8 3 5
10110001
01101000

correct output
11

user output
5 8 11 

Feedback: Output is longer than expected

Test 2

Group: 1, 2, 3

Verdict:

input
10 644 644
0111000100
0000010111

correct output
1932

user output
644 1288 1932 

Feedback: Output is longer than expected

Test 3

Group: 1, 3

Verdict:

input
10 493 986
0001110000
0001100001

correct output
986

user output
493 986 

Feedback: Output is longer than expected

Test 4

Group: 1, 3

Verdict:

input
10 240 720
1011001110
1000000001

correct output
1200

user output
480 960 

Feedback: Output is longer than expected

Test 5

Group: 1, 3

Verdict:

input
10 3 7
1110111111
0010010101

correct output
15

user output
6 9 12 15 

Feedback: Output is longer than expected

Test 6

Group: 3

Verdict:

input
100000 1 1000000000
001100110010101001010111000110...

correct output
50252

user output
3 5 6 7 9 10 11 12 13 14 16 18...

Feedback: Output is longer than expected

Test 7

Group: 2, 3

Verdict:

input
100000 1000000000 1
110010000110110100110110101011...

correct output
25055

user output
1 2 3 4 5 6 7 8 9 10 11 12 13 ...

Feedback: Output is longer than expected

Test 8

Group: 3

Verdict:

input
100000 1000 1000000000
001001101010100000011110000101...

correct output
50001000

user output
3000 4000 5000 6000 8000 9000 ...

Feedback: Output is longer than expected

Test 9

Group: 2, 3

Verdict:

input
100000 1000000000 1000
101010110001010011011011101110...

correct output
24939000

user output
1000 2000 3000 4000 5000 6000 ...

Feedback: Output is longer than expected

Test 10

Group: 2, 3

Verdict:

input
100000 1000000000 1000000000
001000000001000000000010110111...

correct output
25023000000000

user output
1000000000 2000000000 30000000...

Feedback: Output is longer than expected

Test 11

Group: 3

Verdict:

input
100000 123456789 987654321
100010110100011000001111001110...

correct output
5475678967593

user output
123456789 246913578 370370367 ...

Feedback: Output is longer than expected

Test 12

Group: 2, 3

Verdict:

input
100000 987654321 123456789
000100110000010110111101111101...

correct output
3071481453531

user output
123456789 246913578 370370367 ...

Feedback: Output is longer than expected

Test 13

Group: 3

Verdict:

input
100000 1000000 1000000000
001100110010100011000111101100...

correct output
49916000000

user output
2000000 3000000 5000000 600000...

Feedback: Output is longer than expected

Test 14

Group: 3

Verdict:

input
100000 10000000 1000000000
110111101101111110100101011000...

correct output
494930000000

user output
10000000 20000000 30000000 400...

Feedback: Output is longer than expected

Test 15

Group: 3

Verdict:

input
100000 100000000 1000000000
111110000010100011011100110010...

correct output
4547300000000

user output
100000000 200000000 300000000 ...

Feedback: Output is longer than expected

Test 16

Group: 1, 2, 3

Verdict: ACCEPTED

input
1 1 1
1
1

correct output
0

user output
0

Test 17

Group: 1, 3

Verdict:

input
10 600 800
0000000000
1110111111

correct output
1400

user output
800 1400 

Feedback: Output is longer than expected

Test 18

Group: 1, 3

Verdict:

input
10 300 599
1101001010
0011010110

correct output
1198

user output
599 1198 

Feedback: Output is longer than expected

Test 19

Group: 3

Verdict:

input
100000 300000000 500000000
010011101001001010010101101101...

correct output
10000000000000

user output
500000000 1000000000 150000000...

Feedback: Output is longer than expected

Test 20

Group: 3

Verdict:

input
100000 60000 1000000000
110110111011010100001000011011...

correct output
3000000000

user output
1000000000 2000000000 30000000...

Feedback: Output is longer than expected