71072023-12-30 13:24:18IgnácTükörtojás (75 pont)cpp17Accepted 75/758ms4528 KiB
#include <bits/stdc++.h>
using namespace std;

int main() {
	int n;
	string s, t;
	cin >> n >> s >> t;
	int i = 0, j = n - 1, moves = 0;
	bool turn = false;
	while (true) {
		bool out = false;
		/*while ((s[i] == t[i]) ^ turn) {
			i++;
			if (i > j) {
				out = true;
				break;
			}
		}*/

		if (out) break;
		while ((s[j] == t[j]) ^ turn) {
			j--;
			if (i > j) {
				out = true;
				break;
			}
		}

		if (out) break;
		moves++;
		turn = !turn;
	}

	cout << moves;
}
SubtaskSumTestVerdictTimeMemory
base75/75
1Accepted0/03ms1808 KiB
2Accepted0/06ms2308 KiB
3Accepted5/53ms2276 KiB
4Accepted5/53ms2328 KiB
5Accepted5/53ms2528 KiB
6Accepted5/53ms2608 KiB
7Accepted5/53ms2736 KiB
8Accepted5/53ms2952 KiB
9Accepted5/53ms3172 KiB
10Accepted5/53ms3276 KiB
11Accepted5/53ms3404 KiB
12Accepted5/58ms4124 KiB
13Accepted5/58ms4056 KiB
14Accepted5/58ms4056 KiB
15Accepted5/58ms4312 KiB
16Accepted5/58ms4268 KiB
17Accepted5/58ms4528 KiB