#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
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
30 ms |
2388 KB |
Output is correct |
2 |
Correct |
33 ms |
2388 KB |
Output is correct |
3 |
Correct |
30 ms |
2352 KB |
Output is correct |
4 |
Correct |
33 ms |
2392 KB |
Output is correct |
5 |
Correct |
37 ms |
2388 KB |
Output is correct |
6 |
Correct |
31 ms |
2396 KB |
Output is correct |
7 |
Correct |
32 ms |
2396 KB |
Output is correct |
8 |
Correct |
33 ms |
2556 KB |
Output is correct |
9 |
Correct |
33 ms |
2384 KB |
Output is correct |
10 |
Correct |
35 ms |
2396 KB |
Output is correct |
11 |
Correct |
34 ms |
2400 KB |
Output is correct |
12 |
Correct |
33 ms |
2388 KB |
Output is correct |
13 |
Correct |
32 ms |
2332 KB |
Output is correct |
14 |
Correct |
32 ms |
2400 KB |
Output is correct |
15 |
Correct |
32 ms |
2384 KB |
Output is correct |
16 |
Correct |
33 ms |
2388 KB |
Output is correct |
17 |
Correct |
36 ms |
2500 KB |
Output is correct |
18 |
Correct |
33 ms |
2384 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
30 ms |
2388 KB |
Output is correct |
2 |
Correct |
33 ms |
2388 KB |
Output is correct |
3 |
Correct |
30 ms |
2352 KB |
Output is correct |
4 |
Correct |
33 ms |
2392 KB |
Output is correct |
5 |
Correct |
37 ms |
2388 KB |
Output is correct |
6 |
Correct |
31 ms |
2396 KB |
Output is correct |
7 |
Correct |
32 ms |
2396 KB |
Output is correct |
8 |
Correct |
33 ms |
2556 KB |
Output is correct |
9 |
Correct |
33 ms |
2384 KB |
Output is correct |
10 |
Correct |
35 ms |
2396 KB |
Output is correct |
11 |
Correct |
34 ms |
2400 KB |
Output is correct |
12 |
Correct |
33 ms |
2388 KB |
Output is correct |
13 |
Correct |
32 ms |
2332 KB |
Output is correct |
14 |
Correct |
32 ms |
2400 KB |
Output is correct |
15 |
Correct |
32 ms |
2384 KB |
Output is correct |
16 |
Correct |
33 ms |
2388 KB |
Output is correct |
17 |
Correct |
36 ms |
2500 KB |
Output is correct |
18 |
Correct |
33 ms |
2384 KB |
Output is correct |
19 |
Correct |
97 ms |
5424 KB |
Output is correct |
20 |
Correct |
405 ms |
5096 KB |
Output is correct |
21 |
Correct |
42 ms |
4404 KB |
Output is correct |
22 |
Correct |
41 ms |
4020 KB |
Output is correct |
23 |
Correct |
37 ms |
2904 KB |
Output is correct |
24 |
Correct |
38 ms |
2684 KB |
Output is correct |
25 |
Correct |
48 ms |
4296 KB |
Output is correct |
26 |
Correct |
45 ms |
4404 KB |
Output is correct |
27 |
Correct |
57 ms |
4404 KB |
Output is correct |
28 |
Correct |
53 ms |
4372 KB |
Output is correct |
29 |
Correct |
55 ms |
4496 KB |
Output is correct |
30 |
Correct |
39 ms |
2900 KB |
Output is correct |
31 |
Correct |
59 ms |
4584 KB |
Output is correct |
32 |
Correct |
51 ms |
4484 KB |
Output is correct |
33 |
Correct |
37 ms |
2644 KB |
Output is correct |
34 |
Correct |
53 ms |
4396 KB |
Output is correct |
35 |
Correct |
42 ms |
3884 KB |
Output is correct |
36 |
Correct |
38 ms |
2652 KB |
Output is correct |
37 |
Correct |
37 ms |
2640 KB |
Output is correct |
38 |
Correct |
525 ms |
4916 KB |
Output is correct |
39 |
Correct |
441 ms |
4324 KB |
Output is correct |
40 |
Correct |
42 ms |
3912 KB |
Output is correct |
41 |
Correct |
1022 ms |
4820 KB |
Output is correct |
42 |
Correct |
1369 ms |
4144 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
30 ms |
2388 KB |
Output is correct |
2 |
Correct |
33 ms |
2388 KB |
Output is correct |
3 |
Correct |
30 ms |
2352 KB |
Output is correct |
4 |
Correct |
33 ms |
2392 KB |
Output is correct |
5 |
Correct |
37 ms |
2388 KB |
Output is correct |
6 |
Correct |
31 ms |
2396 KB |
Output is correct |
7 |
Correct |
32 ms |
2396 KB |
Output is correct |
8 |
Correct |
33 ms |
2556 KB |
Output is correct |
9 |
Correct |
33 ms |
2384 KB |
Output is correct |
10 |
Correct |
35 ms |
2396 KB |
Output is correct |
11 |
Correct |
34 ms |
2400 KB |
Output is correct |
12 |
Correct |
33 ms |
2388 KB |
Output is correct |
13 |
Correct |
32 ms |
2332 KB |
Output is correct |
14 |
Correct |
32 ms |
2400 KB |
Output is correct |
15 |
Correct |
32 ms |
2384 KB |
Output is correct |
16 |
Correct |
33 ms |
2388 KB |
Output is correct |
17 |
Correct |
36 ms |
2500 KB |
Output is correct |
18 |
Correct |
33 ms |
2384 KB |
Output is correct |
19 |
Correct |
40 ms |
2128 KB |
Output is correct |
20 |
Correct |
40 ms |
2132 KB |
Output is correct |
21 |
Correct |
36 ms |
2240 KB |
Output is correct |
22 |
Correct |
32 ms |
1884 KB |
Output is correct |
23 |
Correct |
35 ms |
1876 KB |
Output is correct |
24 |
Correct |
34 ms |
1872 KB |
Output is correct |
25 |
Correct |
35 ms |
1884 KB |
Output is correct |
26 |
Correct |
36 ms |
2164 KB |
Output is correct |
27 |
Correct |
35 ms |
1896 KB |
Output is correct |
28 |
Correct |
32 ms |
1976 KB |
Output is correct |
29 |
Correct |
36 ms |
1980 KB |
Output is correct |
30 |
Correct |
33 ms |
1876 KB |
Output is correct |
31 |
Correct |
42 ms |
1872 KB |
Output is correct |
32 |
Correct |
46 ms |
2284 KB |
Output is correct |
33 |
Correct |
45 ms |
1876 KB |
Output is correct |
34 |
Correct |
41 ms |
1884 KB |
Output is correct |
35 |
Correct |
43 ms |
1872 KB |
Output is correct |
36 |
Correct |
49 ms |
1872 KB |
Output is correct |
37 |
Correct |
42 ms |
1872 KB |
Output is correct |
38 |
Correct |
43 ms |
1876 KB |
Output is correct |
39 |
Correct |
43 ms |
1872 KB |
Output is correct |
40 |
Correct |
43 ms |
1872 KB |
Output is correct |
41 |
Correct |
43 ms |
1884 KB |
Output is correct |
42 |
Correct |
42 ms |
1880 KB |
Output is correct |
43 |
Correct |
41 ms |
1872 KB |
Output is correct |
44 |
Correct |
42 ms |
1872 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
30 ms |
2388 KB |
Output is correct |
2 |
Correct |
33 ms |
2388 KB |
Output is correct |
3 |
Correct |
30 ms |
2352 KB |
Output is correct |
4 |
Correct |
33 ms |
2392 KB |
Output is correct |
5 |
Correct |
37 ms |
2388 KB |
Output is correct |
6 |
Correct |
31 ms |
2396 KB |
Output is correct |
7 |
Correct |
32 ms |
2396 KB |
Output is correct |
8 |
Correct |
33 ms |
2556 KB |
Output is correct |
9 |
Correct |
33 ms |
2384 KB |
Output is correct |
10 |
Correct |
35 ms |
2396 KB |
Output is correct |
11 |
Correct |
34 ms |
2400 KB |
Output is correct |
12 |
Correct |
33 ms |
2388 KB |
Output is correct |
13 |
Correct |
32 ms |
2332 KB |
Output is correct |
14 |
Correct |
32 ms |
2400 KB |
Output is correct |
15 |
Correct |
32 ms |
2384 KB |
Output is correct |
16 |
Correct |
33 ms |
2388 KB |
Output is correct |
17 |
Correct |
36 ms |
2500 KB |
Output is correct |
18 |
Correct |
33 ms |
2384 KB |
Output is correct |
19 |
Correct |
97 ms |
5424 KB |
Output is correct |
20 |
Correct |
405 ms |
5096 KB |
Output is correct |
21 |
Correct |
42 ms |
4404 KB |
Output is correct |
22 |
Correct |
41 ms |
4020 KB |
Output is correct |
23 |
Correct |
37 ms |
2904 KB |
Output is correct |
24 |
Correct |
38 ms |
2684 KB |
Output is correct |
25 |
Correct |
48 ms |
4296 KB |
Output is correct |
26 |
Correct |
45 ms |
4404 KB |
Output is correct |
27 |
Correct |
57 ms |
4404 KB |
Output is correct |
28 |
Correct |
53 ms |
4372 KB |
Output is correct |
29 |
Correct |
55 ms |
4496 KB |
Output is correct |
30 |
Correct |
39 ms |
2900 KB |
Output is correct |
31 |
Correct |
59 ms |
4584 KB |
Output is correct |
32 |
Correct |
51 ms |
4484 KB |
Output is correct |
33 |
Correct |
37 ms |
2644 KB |
Output is correct |
34 |
Correct |
53 ms |
4396 KB |
Output is correct |
35 |
Correct |
42 ms |
3884 KB |
Output is correct |
36 |
Correct |
38 ms |
2652 KB |
Output is correct |
37 |
Correct |
37 ms |
2640 KB |
Output is correct |
38 |
Correct |
525 ms |
4916 KB |
Output is correct |
39 |
Correct |
441 ms |
4324 KB |
Output is correct |
40 |
Correct |
42 ms |
3912 KB |
Output is correct |
41 |
Correct |
1022 ms |
4820 KB |
Output is correct |
42 |
Correct |
1369 ms |
4144 KB |
Output is correct |
43 |
Correct |
40 ms |
2128 KB |
Output is correct |
44 |
Correct |
40 ms |
2132 KB |
Output is correct |
45 |
Correct |
36 ms |
2240 KB |
Output is correct |
46 |
Correct |
32 ms |
1884 KB |
Output is correct |
47 |
Correct |
35 ms |
1876 KB |
Output is correct |
48 |
Correct |
34 ms |
1872 KB |
Output is correct |
49 |
Correct |
35 ms |
1884 KB |
Output is correct |
50 |
Correct |
36 ms |
2164 KB |
Output is correct |
51 |
Correct |
35 ms |
1896 KB |
Output is correct |
52 |
Correct |
32 ms |
1976 KB |
Output is correct |
53 |
Correct |
36 ms |
1980 KB |
Output is correct |
54 |
Correct |
33 ms |
1876 KB |
Output is correct |
55 |
Correct |
42 ms |
1872 KB |
Output is correct |
56 |
Correct |
46 ms |
2284 KB |
Output is correct |
57 |
Correct |
45 ms |
1876 KB |
Output is correct |
58 |
Correct |
41 ms |
1884 KB |
Output is correct |
59 |
Correct |
43 ms |
1872 KB |
Output is correct |
60 |
Correct |
49 ms |
1872 KB |
Output is correct |
61 |
Correct |
42 ms |
1872 KB |
Output is correct |
62 |
Correct |
43 ms |
1876 KB |
Output is correct |
63 |
Correct |
43 ms |
1872 KB |
Output is correct |
64 |
Correct |
43 ms |
1872 KB |
Output is correct |
65 |
Correct |
43 ms |
1884 KB |
Output is correct |
66 |
Correct |
42 ms |
1880 KB |
Output is correct |
67 |
Correct |
41 ms |
1872 KB |
Output is correct |
68 |
Correct |
42 ms |
1872 KB |
Output is correct |
69 |
Correct |
188 ms |
5132 KB |
Output is correct |
70 |
Correct |
512 ms |
6100 KB |
Output is correct |
71 |
Correct |
43 ms |
2644 KB |
Output is correct |
72 |
Correct |
39 ms |
2432 KB |
Output is correct |
73 |
Correct |
39 ms |
2568 KB |
Output is correct |
74 |
Correct |
46 ms |
4060 KB |
Output is correct |
75 |
Correct |
41 ms |
2600 KB |
Output is correct |
76 |
Correct |
52 ms |
4684 KB |
Output is correct |
77 |
Correct |
48 ms |
4416 KB |
Output is correct |
78 |
Correct |
40 ms |
2644 KB |
Output is correct |
79 |
Correct |
40 ms |
2644 KB |
Output is correct |
80 |
Correct |
125 ms |
4852 KB |
Output is correct |
81 |
Correct |
52 ms |
2692 KB |
Output is correct |
82 |
Correct |
176 ms |
5728 KB |
Output is correct |
83 |
Correct |
119 ms |
5740 KB |
Output is correct |
84 |
Correct |
50 ms |
2640 KB |
Output is correct |
85 |
Correct |
50 ms |
2640 KB |
Output is correct |
86 |
Correct |
76 ms |
4980 KB |
Output is correct |
87 |
Correct |
98 ms |
5720 KB |
Output is correct |
88 |
Correct |
49 ms |
2648 KB |
Output is correct |
89 |
Correct |
85 ms |
5508 KB |
Output is correct |
90 |
Correct |
98 ms |
5796 KB |
Output is correct |
91 |
Correct |
51 ms |
2540 KB |
Output is correct |
92 |
Correct |
136 ms |
4788 KB |
Output is correct |
93 |
Correct |
50 ms |
2644 KB |
Output is correct |
94 |
Correct |
53 ms |
2644 KB |
Output is correct |
95 |
Correct |
51 ms |
2640 KB |
Output is correct |
96 |
Correct |
519 ms |
4148 KB |
Output is correct |
97 |
Correct |
4117 ms |
5908 KB |
Output is correct |
98 |
Correct |
117 ms |
4636 KB |
Output is correct |
99 |
Correct |
1210 ms |
6368 KB |
Output is correct |
100 |
Correct |
1361 ms |
5976 KB |
Output is correct |