Submission #1139494

#TimeUsernameProblemLanguageResultExecution timeMemory
1139494NeltCrossing (JOI21_crossing)C++20
3 / 100
7088 ms1476 KiB
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define ll long long
#define endl "\n"

using namespace std;
using namespace __gnu_pbds;

mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
template <typename T, typename key = less_equal<T>>
using ordered_set = tree<T, null_type, key, rb_tree_tag, tree_order_statistics_node_update>;

void solve()
{
    ll n;
    cin >> n;
    string a, b, c;
    cin >> a >> b >> c;
    ll q;
    cin >> q;
    string t;
    cin >> t;
    bool ok = true;
    for (ll i = 0; i < n; i++)
        if (a[i] == b[i] and b[i] == c[i])
            ok &= a[i] == t[i];
    if (!ok)
        cout << "No\n";
    else
        cout << "Yes\n";
    while (q--)
    {
        ll l, r;
        char ch;
        cin >> l >> r >> ch;
        for (ll i = l - 1; i <= r - 1; i++)
            t[i] = ch;
        bool ok = true;
        for (ll i = 0; i < n; i++)
            if (a[i] == b[i] and b[i] == c[i])
                ok &= a[i] == t[i];
        if (!ok)
            cout << "No\n";
        else
            cout << "Yes\n";
    }
}

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    ll t = 1;
    // precomp();
    // cin >> t;
    for (ll cs = 1; cs <= t; cs++)
        solve();
    // cerr << "\nTime elapsed: " << clock() * 1000.0 / CLOCKS_PER_SEC << " ms\n";
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...