#ifndef SorahISA
#define SorahISA
#include SorahISA __FILE__ SorahISA
string XOR(string S, string T) {
string res(SZ(S), '?');
for (int i = 0; i < SZ(S); ++i) {
if (S[i] == T[i]) res[i] = S[i];
else res[i] = int('J') + int('O') + int('I') - int(S[i]) - int(T[i]);
}
return res;
}
void solve() {
int N; cin >> N;
vector<string> strs(8);
cin >> strs[1] >> strs[2] >> strs[4];
strs[3] = XOR(strs[1], strs[2]);
strs[5] = XOR(strs[1], strs[4]);
strs[6] = XOR(strs[2], strs[4]);
strs[7] = XOR(strs[3], strs[4]);
// for (int i = 1; i <= 7; ++i) debug(i, strs[i]);
// for (int i = 1; i <= 7; ++i) {
// assert(XOR(strs[i], strs[i]) == strs[i]);
// for (int j = i+1; j <= 7; ++j) {
// assert(XOR(strs[i], strs[j]) == strs[i^j]);
// }
// }
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 (int i = 1; i <= 7; ++i) {
if (T == strs[i]) flag = true;
}
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
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
34 ms |
2388 KB |
Output is correct |
2 |
Correct |
37 ms |
2540 KB |
Output is correct |
3 |
Correct |
34 ms |
2388 KB |
Output is correct |
4 |
Correct |
36 ms |
2384 KB |
Output is correct |
5 |
Correct |
35 ms |
2384 KB |
Output is correct |
6 |
Correct |
37 ms |
2384 KB |
Output is correct |
7 |
Correct |
36 ms |
2424 KB |
Output is correct |
8 |
Correct |
37 ms |
2364 KB |
Output is correct |
9 |
Correct |
38 ms |
2396 KB |
Output is correct |
10 |
Correct |
36 ms |
2388 KB |
Output is correct |
11 |
Correct |
37 ms |
2576 KB |
Output is correct |
12 |
Correct |
37 ms |
2388 KB |
Output is correct |
13 |
Correct |
36 ms |
2392 KB |
Output is correct |
14 |
Correct |
37 ms |
2388 KB |
Output is correct |
15 |
Correct |
36 ms |
2384 KB |
Output is correct |
16 |
Correct |
36 ms |
2468 KB |
Output is correct |
17 |
Correct |
36 ms |
2384 KB |
Output is correct |
18 |
Correct |
36 ms |
2392 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
34 ms |
2388 KB |
Output is correct |
2 |
Correct |
37 ms |
2540 KB |
Output is correct |
3 |
Correct |
34 ms |
2388 KB |
Output is correct |
4 |
Correct |
36 ms |
2384 KB |
Output is correct |
5 |
Correct |
35 ms |
2384 KB |
Output is correct |
6 |
Correct |
37 ms |
2384 KB |
Output is correct |
7 |
Correct |
36 ms |
2424 KB |
Output is correct |
8 |
Correct |
37 ms |
2364 KB |
Output is correct |
9 |
Correct |
38 ms |
2396 KB |
Output is correct |
10 |
Correct |
36 ms |
2388 KB |
Output is correct |
11 |
Correct |
37 ms |
2576 KB |
Output is correct |
12 |
Correct |
37 ms |
2388 KB |
Output is correct |
13 |
Correct |
36 ms |
2392 KB |
Output is correct |
14 |
Correct |
37 ms |
2388 KB |
Output is correct |
15 |
Correct |
36 ms |
2384 KB |
Output is correct |
16 |
Correct |
36 ms |
2468 KB |
Output is correct |
17 |
Correct |
36 ms |
2384 KB |
Output is correct |
18 |
Correct |
36 ms |
2392 KB |
Output is correct |
19 |
Correct |
100 ms |
6520 KB |
Output is correct |
20 |
Correct |
417 ms |
7076 KB |
Output is correct |
21 |
Correct |
48 ms |
6252 KB |
Output is correct |
22 |
Correct |
45 ms |
5900 KB |
Output is correct |
23 |
Correct |
44 ms |
3308 KB |
Output is correct |
24 |
Correct |
45 ms |
3408 KB |
Output is correct |
25 |
Correct |
50 ms |
6604 KB |
Output is correct |
26 |
Correct |
49 ms |
6512 KB |
Output is correct |
27 |
Correct |
75 ms |
6452 KB |
Output is correct |
28 |
Correct |
69 ms |
6552 KB |
Output is correct |
29 |
Correct |
66 ms |
6496 KB |
Output is correct |
30 |
Correct |
44 ms |
3376 KB |
Output is correct |
31 |
Correct |
69 ms |
6456 KB |
Output is correct |
32 |
Correct |
60 ms |
6120 KB |
Output is correct |
33 |
Correct |
46 ms |
3408 KB |
Output is correct |
34 |
Correct |
64 ms |
6500 KB |
Output is correct |
35 |
Correct |
44 ms |
5656 KB |
Output is correct |
36 |
Correct |
42 ms |
3408 KB |
Output is correct |
37 |
Correct |
42 ms |
3568 KB |
Output is correct |
38 |
Correct |
1127 ms |
6520 KB |
Output is correct |
39 |
Correct |
3253 ms |
6532 KB |
Output is correct |
40 |
Correct |
48 ms |
5488 KB |
Output is correct |
41 |
Correct |
5847 ms |
6756 KB |
Output is correct |
42 |
Correct |
6036 ms |
5992 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
34 ms |
2388 KB |
Output is correct |
2 |
Correct |
37 ms |
2540 KB |
Output is correct |
3 |
Correct |
34 ms |
2388 KB |
Output is correct |
4 |
Correct |
36 ms |
2384 KB |
Output is correct |
5 |
Correct |
35 ms |
2384 KB |
Output is correct |
6 |
Correct |
37 ms |
2384 KB |
Output is correct |
7 |
Correct |
36 ms |
2424 KB |
Output is correct |
8 |
Correct |
37 ms |
2364 KB |
Output is correct |
9 |
Correct |
38 ms |
2396 KB |
Output is correct |
10 |
Correct |
36 ms |
2388 KB |
Output is correct |
11 |
Correct |
37 ms |
2576 KB |
Output is correct |
12 |
Correct |
37 ms |
2388 KB |
Output is correct |
13 |
Correct |
36 ms |
2392 KB |
Output is correct |
14 |
Correct |
37 ms |
2388 KB |
Output is correct |
15 |
Correct |
36 ms |
2384 KB |
Output is correct |
16 |
Correct |
36 ms |
2468 KB |
Output is correct |
17 |
Correct |
36 ms |
2384 KB |
Output is correct |
18 |
Correct |
36 ms |
2392 KB |
Output is correct |
19 |
Correct |
35 ms |
2388 KB |
Output is correct |
20 |
Correct |
34 ms |
2368 KB |
Output is correct |
21 |
Correct |
37 ms |
2384 KB |
Output is correct |
22 |
Correct |
33 ms |
2136 KB |
Output is correct |
23 |
Correct |
37 ms |
2392 KB |
Output is correct |
24 |
Correct |
35 ms |
2388 KB |
Output is correct |
25 |
Correct |
37 ms |
2392 KB |
Output is correct |
26 |
Correct |
35 ms |
2388 KB |
Output is correct |
27 |
Correct |
37 ms |
2532 KB |
Output is correct |
28 |
Correct |
33 ms |
2128 KB |
Output is correct |
29 |
Correct |
39 ms |
2352 KB |
Output is correct |
30 |
Correct |
39 ms |
2420 KB |
Output is correct |
31 |
Incorrect |
38 ms |
2384 KB |
Output isn't correct |
32 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
34 ms |
2388 KB |
Output is correct |
2 |
Correct |
37 ms |
2540 KB |
Output is correct |
3 |
Correct |
34 ms |
2388 KB |
Output is correct |
4 |
Correct |
36 ms |
2384 KB |
Output is correct |
5 |
Correct |
35 ms |
2384 KB |
Output is correct |
6 |
Correct |
37 ms |
2384 KB |
Output is correct |
7 |
Correct |
36 ms |
2424 KB |
Output is correct |
8 |
Correct |
37 ms |
2364 KB |
Output is correct |
9 |
Correct |
38 ms |
2396 KB |
Output is correct |
10 |
Correct |
36 ms |
2388 KB |
Output is correct |
11 |
Correct |
37 ms |
2576 KB |
Output is correct |
12 |
Correct |
37 ms |
2388 KB |
Output is correct |
13 |
Correct |
36 ms |
2392 KB |
Output is correct |
14 |
Correct |
37 ms |
2388 KB |
Output is correct |
15 |
Correct |
36 ms |
2384 KB |
Output is correct |
16 |
Correct |
36 ms |
2468 KB |
Output is correct |
17 |
Correct |
36 ms |
2384 KB |
Output is correct |
18 |
Correct |
36 ms |
2392 KB |
Output is correct |
19 |
Correct |
100 ms |
6520 KB |
Output is correct |
20 |
Correct |
417 ms |
7076 KB |
Output is correct |
21 |
Correct |
48 ms |
6252 KB |
Output is correct |
22 |
Correct |
45 ms |
5900 KB |
Output is correct |
23 |
Correct |
44 ms |
3308 KB |
Output is correct |
24 |
Correct |
45 ms |
3408 KB |
Output is correct |
25 |
Correct |
50 ms |
6604 KB |
Output is correct |
26 |
Correct |
49 ms |
6512 KB |
Output is correct |
27 |
Correct |
75 ms |
6452 KB |
Output is correct |
28 |
Correct |
69 ms |
6552 KB |
Output is correct |
29 |
Correct |
66 ms |
6496 KB |
Output is correct |
30 |
Correct |
44 ms |
3376 KB |
Output is correct |
31 |
Correct |
69 ms |
6456 KB |
Output is correct |
32 |
Correct |
60 ms |
6120 KB |
Output is correct |
33 |
Correct |
46 ms |
3408 KB |
Output is correct |
34 |
Correct |
64 ms |
6500 KB |
Output is correct |
35 |
Correct |
44 ms |
5656 KB |
Output is correct |
36 |
Correct |
42 ms |
3408 KB |
Output is correct |
37 |
Correct |
42 ms |
3568 KB |
Output is correct |
38 |
Correct |
1127 ms |
6520 KB |
Output is correct |
39 |
Correct |
3253 ms |
6532 KB |
Output is correct |
40 |
Correct |
48 ms |
5488 KB |
Output is correct |
41 |
Correct |
5847 ms |
6756 KB |
Output is correct |
42 |
Correct |
6036 ms |
5992 KB |
Output is correct |
43 |
Correct |
35 ms |
2388 KB |
Output is correct |
44 |
Correct |
34 ms |
2368 KB |
Output is correct |
45 |
Correct |
37 ms |
2384 KB |
Output is correct |
46 |
Correct |
33 ms |
2136 KB |
Output is correct |
47 |
Correct |
37 ms |
2392 KB |
Output is correct |
48 |
Correct |
35 ms |
2388 KB |
Output is correct |
49 |
Correct |
37 ms |
2392 KB |
Output is correct |
50 |
Correct |
35 ms |
2388 KB |
Output is correct |
51 |
Correct |
37 ms |
2532 KB |
Output is correct |
52 |
Correct |
33 ms |
2128 KB |
Output is correct |
53 |
Correct |
39 ms |
2352 KB |
Output is correct |
54 |
Correct |
39 ms |
2420 KB |
Output is correct |
55 |
Incorrect |
38 ms |
2384 KB |
Output isn't correct |
56 |
Halted |
0 ms |
0 KB |
- |