#include<bits/stdc++.h>
using namespace std;
using ll = long long;
int n;
string T = "JOI";
string get(string a, string b) {
string res;
for(int i = 0; i < n; i++)
if(a[i] == b[i]) res += a[i];
else {
int k = 0;
while(T[k] == a[i] || T[k] == b[i]) k++;
res += T[k];
}
return res;
}
vector<string> st;
bool check(string s) {
for(string cur : st)
if(cur == s) return 1;
return 0;
}
int main() {
ios::sync_with_stdio(0);
cin.tie(0);cout.tie(0);
cin >> n;
string s[3];
cin >> s[0] >> s[1] >> s[2];
st.push_back(s[0]);
st.push_back(s[1]);
st.push_back(s[2]);
st.push_back(get(s[0], s[1]));
st.push_back(get(s[0], s[2]));
st.push_back(get(s[1], s[2]));
st.push_back(get(s[0], get(s[1], s[2])));
int q;
cin >> q;
string t;
cin >> t;
cout << (check(t) ? "Yes\n" : "No\n");
while(q--) {
int l, r; char x;
cin >> l >> r >> x;
for(int i = l - 1; i < r; i++)
t[i] = x;
cout << (check(t) ? "Yes\n" : "No\n");
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
69 ms |
2244 KB |
Output is correct |
2 |
Correct |
74 ms |
2340 KB |
Output is correct |
3 |
Correct |
83 ms |
2264 KB |
Output is correct |
4 |
Correct |
83 ms |
2276 KB |
Output is correct |
5 |
Correct |
73 ms |
2344 KB |
Output is correct |
6 |
Correct |
71 ms |
2236 KB |
Output is correct |
7 |
Correct |
75 ms |
2308 KB |
Output is correct |
8 |
Correct |
78 ms |
2364 KB |
Output is correct |
9 |
Correct |
75 ms |
2392 KB |
Output is correct |
10 |
Correct |
79 ms |
2380 KB |
Output is correct |
11 |
Correct |
76 ms |
2392 KB |
Output is correct |
12 |
Correct |
74 ms |
2376 KB |
Output is correct |
13 |
Correct |
77 ms |
2344 KB |
Output is correct |
14 |
Correct |
74 ms |
2424 KB |
Output is correct |
15 |
Correct |
75 ms |
2452 KB |
Output is correct |
16 |
Correct |
74 ms |
2368 KB |
Output is correct |
17 |
Correct |
76 ms |
2368 KB |
Output is correct |
18 |
Correct |
83 ms |
2260 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
69 ms |
2244 KB |
Output is correct |
2 |
Correct |
74 ms |
2340 KB |
Output is correct |
3 |
Correct |
83 ms |
2264 KB |
Output is correct |
4 |
Correct |
83 ms |
2276 KB |
Output is correct |
5 |
Correct |
73 ms |
2344 KB |
Output is correct |
6 |
Correct |
71 ms |
2236 KB |
Output is correct |
7 |
Correct |
75 ms |
2308 KB |
Output is correct |
8 |
Correct |
78 ms |
2364 KB |
Output is correct |
9 |
Correct |
75 ms |
2392 KB |
Output is correct |
10 |
Correct |
79 ms |
2380 KB |
Output is correct |
11 |
Correct |
76 ms |
2392 KB |
Output is correct |
12 |
Correct |
74 ms |
2376 KB |
Output is correct |
13 |
Correct |
77 ms |
2344 KB |
Output is correct |
14 |
Correct |
74 ms |
2424 KB |
Output is correct |
15 |
Correct |
75 ms |
2452 KB |
Output is correct |
16 |
Correct |
74 ms |
2368 KB |
Output is correct |
17 |
Correct |
76 ms |
2368 KB |
Output is correct |
18 |
Correct |
83 ms |
2260 KB |
Output is correct |
19 |
Execution timed out |
7040 ms |
6132 KB |
Time limit exceeded |
20 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
69 ms |
2244 KB |
Output is correct |
2 |
Correct |
74 ms |
2340 KB |
Output is correct |
3 |
Correct |
83 ms |
2264 KB |
Output is correct |
4 |
Correct |
83 ms |
2276 KB |
Output is correct |
5 |
Correct |
73 ms |
2344 KB |
Output is correct |
6 |
Correct |
71 ms |
2236 KB |
Output is correct |
7 |
Correct |
75 ms |
2308 KB |
Output is correct |
8 |
Correct |
78 ms |
2364 KB |
Output is correct |
9 |
Correct |
75 ms |
2392 KB |
Output is correct |
10 |
Correct |
79 ms |
2380 KB |
Output is correct |
11 |
Correct |
76 ms |
2392 KB |
Output is correct |
12 |
Correct |
74 ms |
2376 KB |
Output is correct |
13 |
Correct |
77 ms |
2344 KB |
Output is correct |
14 |
Correct |
74 ms |
2424 KB |
Output is correct |
15 |
Correct |
75 ms |
2452 KB |
Output is correct |
16 |
Correct |
74 ms |
2368 KB |
Output is correct |
17 |
Correct |
76 ms |
2368 KB |
Output is correct |
18 |
Correct |
83 ms |
2260 KB |
Output is correct |
19 |
Correct |
78 ms |
2252 KB |
Output is correct |
20 |
Correct |
91 ms |
2304 KB |
Output is correct |
21 |
Correct |
75 ms |
2440 KB |
Output is correct |
22 |
Correct |
74 ms |
2148 KB |
Output is correct |
23 |
Correct |
74 ms |
2424 KB |
Output is correct |
24 |
Correct |
71 ms |
2276 KB |
Output is correct |
25 |
Correct |
74 ms |
2404 KB |
Output is correct |
26 |
Correct |
71 ms |
2272 KB |
Output is correct |
27 |
Correct |
77 ms |
2348 KB |
Output is correct |
28 |
Correct |
67 ms |
2128 KB |
Output is correct |
29 |
Correct |
75 ms |
2336 KB |
Output is correct |
30 |
Correct |
69 ms |
2204 KB |
Output is correct |
31 |
Incorrect |
74 ms |
2372 KB |
Output isn't correct |
32 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
69 ms |
2244 KB |
Output is correct |
2 |
Correct |
74 ms |
2340 KB |
Output is correct |
3 |
Correct |
83 ms |
2264 KB |
Output is correct |
4 |
Correct |
83 ms |
2276 KB |
Output is correct |
5 |
Correct |
73 ms |
2344 KB |
Output is correct |
6 |
Correct |
71 ms |
2236 KB |
Output is correct |
7 |
Correct |
75 ms |
2308 KB |
Output is correct |
8 |
Correct |
78 ms |
2364 KB |
Output is correct |
9 |
Correct |
75 ms |
2392 KB |
Output is correct |
10 |
Correct |
79 ms |
2380 KB |
Output is correct |
11 |
Correct |
76 ms |
2392 KB |
Output is correct |
12 |
Correct |
74 ms |
2376 KB |
Output is correct |
13 |
Correct |
77 ms |
2344 KB |
Output is correct |
14 |
Correct |
74 ms |
2424 KB |
Output is correct |
15 |
Correct |
75 ms |
2452 KB |
Output is correct |
16 |
Correct |
74 ms |
2368 KB |
Output is correct |
17 |
Correct |
76 ms |
2368 KB |
Output is correct |
18 |
Correct |
83 ms |
2260 KB |
Output is correct |
19 |
Execution timed out |
7040 ms |
6132 KB |
Time limit exceeded |
20 |
Halted |
0 ms |
0 KB |
- |