#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';
if (a[i] != 'O' && b[i] != 'O') ret[i] = 'O';
if (a[i] != 'J' && b[i] != 'J') ret[i] = 'J';
}
}
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 |
1 |
Incorrect |
35 ms |
2312 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
35 ms |
2312 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
35 ms |
2312 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
35 ms |
2312 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |