This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "bits/stdc++.h"
using namespace std;
#ifdef Nero
#include "Deb.h"
#else
#define deb(...)
#endif
int main(){
ios::sync_with_stdio(false);
cin.tie(nullptr);
int n;
cin >> n;
vector<string> s(3);
for (int i = 0; i < 3; ++i) cin >> s[i];
set<string> se;
auto merge = [&](string a, string b) {
string ret;
ret.resize(n);
for (int i = 0; i < n; ++i) {
if (a[i] == b[i]) {
ret[i] = a[i];
} else {
if (a[i] != 'I' && b[i] != 'I') ret[i] = 'I';
else if (a[i] != 'O' && b[i] != 'O') ret[i] = 'O';
else if (a[i] != 'J' && b[i] != 'J') ret[i] = 'J';
else assert(false);
}
}
return ret;
};
for (int i = 0; i < 3; ++i) {
for (int j = 0; j < 3; ++j) {
for (int k = 0; k < 3; ++k) {
se.insert(merge(merge(s[i], s[j]), s[k]));
}
}
}
//deb(se) cout << '\n';
int q;
cin >> q;
string t;
cin >> t;
cout << (se.count(t) ? "Yes" : "No") << '\n';
while (q--) {
int l, r;
cin >> l >> r;
--l, --r;
char c;
cin >> c;
for (int i = l; i <= r; ++i) {
t[i] = c;
}
cout << (se.count(t) ? "Yes" : "No") << '\n';
}
return 0;
}
# | 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... |