#include <bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
//#pragma GCC target("popcnt")
using namespace __gnu_pbds;
using namespace std;
using ordered_set = tree<int, null_type, less_equal<>, rb_tree_tag, tree_order_statistics_node_update>;
#define popcount __builtin_popcountll
#define all(a) (a).begin(), (a).end()
string cross(const string& A, const string& B) {
string res;
res.resize(A.size());
for (int i = 0; i < A.size(); i++) {
res[i] = A[i] == B[i] ? A[i] : A[i] ^ B[i] ^ 'I' ^ 'O' ^ 'J';
}
return res;
}
signed main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
cout.tie(nullptr);
int n; cin >> n;
string A,B,C; cin >> A >> B >> C;
auto D = cross(A, B);
auto E = cross(B, C);
auto F = cross(C, A);
auto G = cross(D, E);
auto H = cross(E, F);
auto I = cross(F, D);
string T; int q;
cin >> q >> T;
auto solve = [&]() {
cout << (T == A || T == B || T == C || T == D || T == E || T == F || T == G || T == H || T == I ? "Yes" : "No") << "\n";
};
solve();
while (q--) {
int l,r; char c; cin >> l >> r >> c;
for (int i = l-1; i <= r-1; i++)
T[i] = c;
solve();
}
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |