/ SeriousOJ /

Record Detail

Wrong Answer


  
# Status Time Cost Memory Cost
#1 Accepted 1ms 768.0 KiB
#2 Wrong Answer 1ms 532.0 KiB
#3 Wrong Answer 6ms 576.0 KiB

Code

#include <bits/stdc++.h>

using namespace std;

#define int int64_t
#define el '\n'

void run_case(int tc) {
  int n;
  cin >> n;
  string s, p;
  cin >> s >> p;
  for (int i = 0; i < n - 1; i++) {
    if (s[i] != p[i]) {
      if (p[i] == '0') {
        s[i] = '0';
        s[i + 1] = '1';
      } else {
        s[i] = '1';
        s[i + 1] = '0';
      }
    }
  }
  cout << (s == p ? "YES\n" : "NO\n");
}

int32_t main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int _t = 1;
  cin >> _t;
  for (int i = 1; i <= _t; i++) {
    run_case(i);
  }
}

Information

Submit By
Type
Submission
Problem
P1233 B. Make Binary Strings Equal
Contest
Happy New Year 2026
Language
C++17 (G++ 13.2.0)
Submit At
2026-01-06 15:00:42
Judged At
2026-01-06 15:00:43
Judged By
Score
0
Total Time
6ms
Peak Memory
768.0 KiB