/ SeriousOJ /

Record Detail

Time Exceeded


  
# Status Time Cost Memory Cost
#1 Time Exceeded ≥599ms ≥28.434 MiB
#2 Time Exceeded ≥597ms ≥28.414 MiB

Code

#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define testCase ll t; cin >> t; while (t--)
#define Iread ll n; cin >> n; for (ll i = 0; i < n; i++)
#define loop(n) for (ll i = 0; i < n; i++)
#define dbloop(n, m)  for (ll i = 0; i < n; ++i) for (ll j = 0; j < m; ++j)
#define dloop(n) for (ll i = 0, j = n - 1; i < j; ++i, --j)
#define arr(n) ll arr[n]
#define vi vector<ll>
#define ain(arr, n) for (ll i = 0; i < n; ++i) {cin >> arr[i]; }
#define vin(v) for (auto& i : v) cin >> i;
#define prnt(n) for (const auto& i : n) { cout << i << " "; } cout << "\n";
#define endl "\n"

int main() {
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
//start
    testCase {
        ll n; cin >> n; 
        string s; cin >> s; 
        string p; cin >> p; 
        if (n == 1 && s[0] != p[0]) {
            cout << "NO" << endl; 
            continue;
        } else {
            cout << "YES" << endl; 
            continue;
        }
        
        bool flg = 0; 
        for (ll i = 0; i < p.size(); i++) {
            if (p[i] == '0' && p[i+1] == '0') {
                //cout << "NO" << endl; 
                flg = 1; 
                break; 
            }
        }
        (flg == 1) ? cout << "NO\n" : cout << "YES\n"; 
    }
}

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:20:34
Judged At
2026-01-06 15:20:34
Judged By
Score
0
Total Time
≥599ms
Peak Memory
≥28.434 MiB