#include <bits/stdc++.h>
using namespace std;
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
int n;
cin >> n;
string sa, sb, sc;
cin >> sa >> sb >> sc;
auto Cross = [&](string s, string t) {
string res = "";
for (int i = 0; i < n; i++) {
if (s[i] == t[i]) {
res += s[i];
} else {
res += (s[i] ^ t[i] ^ 'J' ^ 'O' ^ 'I');
}
}
return res;
};
vector<string> a;
a.push_back(sa);
a.push_back(sb);
a.push_back(sc);
a.push_back(Cross(sa, sb));
a.push_back(Cross(sa, sc));
a.push_back(Cross(sb, sc));
a.push_back(Cross(sa, Cross(sb, sc)));
int q;
cin >> q;
string t;
cin >> t;
function<void()> Answer = [&]() {
for (int i = 0; i < a.size(); i++) {
if (t == a[i]) {
cout << "Yes" << '\n';
return;
}
}
cout << "No" << '\n';
};
Answer();
while (q--) {
int l, r;
char foo;
cin >> l >> r >> foo;
--l; --r;
for (int i = l; i <= r; i++) {
t[i] = foo;
}
Answer();
}
return 0;
}
Compilation message
Main.cpp: In lambda function:
Main.cpp:36:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::__cxx11::basic_string<char> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
36 | for (int i = 0; i < a.size(); i++) {
| ~~^~~~~~~~~~
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
49 ms |
2240 KB |
Output is correct |
2 |
Correct |
53 ms |
2364 KB |
Output is correct |
3 |
Correct |
86 ms |
2256 KB |
Output is correct |
4 |
Correct |
51 ms |
2268 KB |
Output is correct |
5 |
Correct |
50 ms |
2300 KB |
Output is correct |
6 |
Correct |
49 ms |
2236 KB |
Output is correct |
7 |
Correct |
49 ms |
2380 KB |
Output is correct |
8 |
Correct |
54 ms |
2392 KB |
Output is correct |
9 |
Correct |
58 ms |
2416 KB |
Output is correct |
10 |
Correct |
54 ms |
2332 KB |
Output is correct |
11 |
Correct |
52 ms |
2412 KB |
Output is correct |
12 |
Correct |
53 ms |
2352 KB |
Output is correct |
13 |
Correct |
53 ms |
2380 KB |
Output is correct |
14 |
Correct |
52 ms |
2384 KB |
Output is correct |
15 |
Correct |
51 ms |
2324 KB |
Output is correct |
16 |
Correct |
54 ms |
2380 KB |
Output is correct |
17 |
Correct |
51 ms |
2344 KB |
Output is correct |
18 |
Correct |
92 ms |
2304 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
49 ms |
2240 KB |
Output is correct |
2 |
Correct |
53 ms |
2364 KB |
Output is correct |
3 |
Correct |
86 ms |
2256 KB |
Output is correct |
4 |
Correct |
51 ms |
2268 KB |
Output is correct |
5 |
Correct |
50 ms |
2300 KB |
Output is correct |
6 |
Correct |
49 ms |
2236 KB |
Output is correct |
7 |
Correct |
49 ms |
2380 KB |
Output is correct |
8 |
Correct |
54 ms |
2392 KB |
Output is correct |
9 |
Correct |
58 ms |
2416 KB |
Output is correct |
10 |
Correct |
54 ms |
2332 KB |
Output is correct |
11 |
Correct |
52 ms |
2412 KB |
Output is correct |
12 |
Correct |
53 ms |
2352 KB |
Output is correct |
13 |
Correct |
53 ms |
2380 KB |
Output is correct |
14 |
Correct |
52 ms |
2384 KB |
Output is correct |
15 |
Correct |
51 ms |
2324 KB |
Output is correct |
16 |
Correct |
54 ms |
2380 KB |
Output is correct |
17 |
Correct |
51 ms |
2344 KB |
Output is correct |
18 |
Correct |
92 ms |
2304 KB |
Output is correct |
19 |
Execution timed out |
7014 ms |
6292 KB |
Time limit exceeded |
20 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
49 ms |
2240 KB |
Output is correct |
2 |
Correct |
53 ms |
2364 KB |
Output is correct |
3 |
Correct |
86 ms |
2256 KB |
Output is correct |
4 |
Correct |
51 ms |
2268 KB |
Output is correct |
5 |
Correct |
50 ms |
2300 KB |
Output is correct |
6 |
Correct |
49 ms |
2236 KB |
Output is correct |
7 |
Correct |
49 ms |
2380 KB |
Output is correct |
8 |
Correct |
54 ms |
2392 KB |
Output is correct |
9 |
Correct |
58 ms |
2416 KB |
Output is correct |
10 |
Correct |
54 ms |
2332 KB |
Output is correct |
11 |
Correct |
52 ms |
2412 KB |
Output is correct |
12 |
Correct |
53 ms |
2352 KB |
Output is correct |
13 |
Correct |
53 ms |
2380 KB |
Output is correct |
14 |
Correct |
52 ms |
2384 KB |
Output is correct |
15 |
Correct |
51 ms |
2324 KB |
Output is correct |
16 |
Correct |
54 ms |
2380 KB |
Output is correct |
17 |
Correct |
51 ms |
2344 KB |
Output is correct |
18 |
Correct |
92 ms |
2304 KB |
Output is correct |
19 |
Correct |
54 ms |
2232 KB |
Output is correct |
20 |
Correct |
88 ms |
2268 KB |
Output is correct |
21 |
Correct |
59 ms |
2436 KB |
Output is correct |
22 |
Correct |
49 ms |
2228 KB |
Output is correct |
23 |
Correct |
54 ms |
2328 KB |
Output is correct |
24 |
Correct |
51 ms |
2316 KB |
Output is correct |
25 |
Correct |
61 ms |
2444 KB |
Output is correct |
26 |
Correct |
50 ms |
2240 KB |
Output is correct |
27 |
Correct |
53 ms |
2556 KB |
Output is correct |
28 |
Correct |
48 ms |
2124 KB |
Output is correct |
29 |
Correct |
53 ms |
2420 KB |
Output is correct |
30 |
Correct |
48 ms |
2244 KB |
Output is correct |
31 |
Incorrect |
52 ms |
2380 KB |
Output isn't correct |
32 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
49 ms |
2240 KB |
Output is correct |
2 |
Correct |
53 ms |
2364 KB |
Output is correct |
3 |
Correct |
86 ms |
2256 KB |
Output is correct |
4 |
Correct |
51 ms |
2268 KB |
Output is correct |
5 |
Correct |
50 ms |
2300 KB |
Output is correct |
6 |
Correct |
49 ms |
2236 KB |
Output is correct |
7 |
Correct |
49 ms |
2380 KB |
Output is correct |
8 |
Correct |
54 ms |
2392 KB |
Output is correct |
9 |
Correct |
58 ms |
2416 KB |
Output is correct |
10 |
Correct |
54 ms |
2332 KB |
Output is correct |
11 |
Correct |
52 ms |
2412 KB |
Output is correct |
12 |
Correct |
53 ms |
2352 KB |
Output is correct |
13 |
Correct |
53 ms |
2380 KB |
Output is correct |
14 |
Correct |
52 ms |
2384 KB |
Output is correct |
15 |
Correct |
51 ms |
2324 KB |
Output is correct |
16 |
Correct |
54 ms |
2380 KB |
Output is correct |
17 |
Correct |
51 ms |
2344 KB |
Output is correct |
18 |
Correct |
92 ms |
2304 KB |
Output is correct |
19 |
Execution timed out |
7014 ms |
6292 KB |
Time limit exceeded |
20 |
Halted |
0 ms |
0 KB |
- |