/ SeriousOJ /

Record Detail

Compile Error

foo.cc: In function 'int main()':
foo.cc:14:68: error: expected ';' before ')' token
   14 |                                 b1[i] = ((b1[i] == '1') ? '0': '1'));
      |                                                                    ^
      |                                                                    ;
foo.cc:15:72: error: expected ';' before ')' token
   15 |                                 b1[j+1] = ((b1[j+1] == '1') ? '0': '1'));
      |                                                                        ^
      |                                                                        ;

Code

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

int main()
{
    int n; int m;
	cin >> n;
	for (int i = 0; i < n; i++){
		cin >> m; string b1; string b2;
		cin >> b1; cin >> b2;
		for (int j = 0; j < m - 1; j++){
			if (b1[j] != b2[j]){
				b1[i] = ((b1[i] == '1') ? '0': '1'));
				b1[j+1] = ((b1[j+1] == '1') ? '0': '1'));
			}
		}
		if (b1 == b2){
			cout << "YES" << endl;
		}
		else{
			cout << "NO" << endl;	
		}
	}
	return 0;
}

Information

Submit By
Type
Pretest
Problem
P1233 B. Make Binary Strings Equal
Language
C++17 (G++ 13.2.0)
Submit At
2026-01-06 15:05:37
Judged At
2026-01-06 15:05:38
Judged By
Score
0
Total Time
0ms
Peak Memory
0 Bytes