This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#ifndef SorahISA
#define SorahISA
#include SorahISA __FILE__ SorahISA
void solve() {
int N; cin >> N;
string Sa, Sb, Sc; cin >> Sa >> Sb >> Sc;
set<string> st;
st.ee(Sa), st.ee(Sb), st.ee(Sc);
auto XOR = [&](const string &S, const string &T) -> string {
string res = S;
for (int i = 0; i < N; ++i) {
if (S[i] != T[i]) res[i] = int('J') + int('O') + int('I') - int(S[i]) - int(T[i]);
}
return res;
};
while (true) {
bool flag = false;
for (const string &s : st) for (const string &t : st) {
if (st.ee(XOR(s, t)).second) { flag = true; break; }
}
if (!flag) break;
}
// debug(SZ(st));
// for (const string &str : st) debug(str);
int Q; cin >> Q;
string T; cin >> T;
for (int q = 0; q <= Q; ++q) {
if (q) {
int l, r; cin >> l >> r, --l;
char c; cin >> c;
fill(begin(T) + l, begin(T) + r, c);
}
bool flag = false;
for (const string &str : st) {
if (str == T) { flag = true; break; }
}
cout << (flag ? "Yes" : "No") << "\n";
}
}
int32_t main() {
fastIO();
int t = 1; // cin >> t;
for (int _ = 1; _ <= t; ++_) {
solve();
}
return 0;
}
#else
#ifdef local
#define _GLIBCXX_DEBUG 1
#endif
#pragma GCC optimize("Ofast", "unroll-loops")
#include <bits/stdc++.h>
using namespace std;
using int64 = long long;
#define int int64
using float80 = long double;
#define double float80
using pii = pair<int, int>;
template <typename T> using Prior = std::priority_queue<T>;
template <typename T> using prior = std::priority_queue<T, vector<T>, greater<T>>;
#define eb emplace_back
#define ef emplace_front
#define ee emplace
#define pb pop_back
#define pf pop_front
#define ALL(x) begin(x), end(x)
#define RALL(x) rbegin(x), rend(x)
#define SZ(x) ((int)(x).size())
#ifdef local
#define fastIO() void()
#define debug(...) \
fprintf(stderr, "\u001b[33m"), \
fprintf(stderr, "At [%s], line %d: (%s) = ", __FUNCTION__, __LINE__, #__VA_ARGS__), \
_do(__VA_ARGS__), \
fprintf(stderr, "\u001b[0m")
template <typename T> void _do(T &&_t) { cerr << _t << "\n"; }
template <typename T, typename ...U> void _do(T &&_t, U &&..._u) { cerr << _t << ", ", _do(_u...); }
#else
#define fastIO() ios_base::sync_with_stdio(0), cin.tie(0)
#define debug(...) void()
#endif
template <typename T, typename U> bool chmin(T &lhs, U rhs) { return lhs > rhs ? lhs = rhs, 1 : 0; }
template <typename T, typename U> bool chmax(T &lhs, U rhs) { return lhs < rhs ? lhs = rhs, 1 : 0; }
#endif
# | 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... |