#include <bits/stdc++.h>
using namespace std;
#define ull unsigned long long
#define ll long long
#define ui unsigned int
#define us unsigned short
#define inf_int 1e9
#define inf_ll 1e18
#define mod 1000000007
#define smod 998244353
map<pair<char, char>, char> mp;
int main(){
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
mp[{'J', 'O'}] = mp[{'O', 'J'}] = 'I';
mp[{'J', 'I'}] = mp[{'I', 'J'}] = 'O';
mp[{'I', 'O'}] = mp[{'O', 'I'}] = 'J';
int n;
cin >> n;
set<string> st;
vector<string> v;
for(int x=0;x<3;x++){
string s;
cin >> s;
if(!st.count(s)){
st.insert(s);
v.push_back(s);
}
}
for(int x=0;x<v.size();x++){
for(int y=0;y<x;y++){
string tmp;
for(int z=0;z<v[x].length();z++){
if(v[x][z] == v[y][z]){
tmp.push_back(v[x][z]);
} else {
tmp.push_back(mp[{v[x][z], v[y][z]}]);
}
}
if(!st.count(tmp)){
st.insert(tmp);
v.push_back(tmp);
}
}
}
int q;
cin >> q;
string t;
cin >> t;
if(st.count(t)){
cout << "Yes\n";
} else {
cout << "No\n";
}
for(int i=1;i<=q;i++){
int l, r;
char c;
cin >> l >> r >> c;
l--; r--;
for(int x=l;x<=r;x++){
t[x] = c;
}
if(st.count(t)){
cout << "Yes\n";
} else {
cout << "No\n";
}
}
return 0;
}
Compilation message
Main.cpp: In function 'int main()':
Main.cpp:41:15: 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]
41 | for(int x=0;x<v.size();x++){
| ~^~~~~~~~~
Main.cpp:44:17: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
44 | for(int z=0;z<v[x].length();z++){
| ~^~~~~~~~~~~~~~
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
47 ms |
820 KB |
Output is correct |
2 |
Correct |
52 ms |
2424 KB |
Output is correct |
3 |
Correct |
91 ms |
2244 KB |
Output is correct |
4 |
Correct |
54 ms |
2244 KB |
Output is correct |
5 |
Correct |
51 ms |
2364 KB |
Output is correct |
6 |
Correct |
50 ms |
2264 KB |
Output is correct |
7 |
Correct |
50 ms |
2372 KB |
Output is correct |
8 |
Correct |
51 ms |
2412 KB |
Output is correct |
9 |
Correct |
48 ms |
2372 KB |
Output is correct |
10 |
Correct |
55 ms |
2316 KB |
Output is correct |
11 |
Correct |
51 ms |
2352 KB |
Output is correct |
12 |
Correct |
55 ms |
2372 KB |
Output is correct |
13 |
Correct |
48 ms |
2372 KB |
Output is correct |
14 |
Correct |
51 ms |
2396 KB |
Output is correct |
15 |
Correct |
48 ms |
2364 KB |
Output is correct |
16 |
Correct |
52 ms |
2452 KB |
Output is correct |
17 |
Correct |
54 ms |
2416 KB |
Output is correct |
18 |
Correct |
90 ms |
2276 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
47 ms |
820 KB |
Output is correct |
2 |
Correct |
52 ms |
2424 KB |
Output is correct |
3 |
Correct |
91 ms |
2244 KB |
Output is correct |
4 |
Correct |
54 ms |
2244 KB |
Output is correct |
5 |
Correct |
51 ms |
2364 KB |
Output is correct |
6 |
Correct |
50 ms |
2264 KB |
Output is correct |
7 |
Correct |
50 ms |
2372 KB |
Output is correct |
8 |
Correct |
51 ms |
2412 KB |
Output is correct |
9 |
Correct |
48 ms |
2372 KB |
Output is correct |
10 |
Correct |
55 ms |
2316 KB |
Output is correct |
11 |
Correct |
51 ms |
2352 KB |
Output is correct |
12 |
Correct |
55 ms |
2372 KB |
Output is correct |
13 |
Correct |
48 ms |
2372 KB |
Output is correct |
14 |
Correct |
51 ms |
2396 KB |
Output is correct |
15 |
Correct |
48 ms |
2364 KB |
Output is correct |
16 |
Correct |
52 ms |
2452 KB |
Output is correct |
17 |
Correct |
54 ms |
2416 KB |
Output is correct |
18 |
Correct |
90 ms |
2276 KB |
Output is correct |
19 |
Execution timed out |
7050 ms |
4184 KB |
Time limit exceeded |
20 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
47 ms |
820 KB |
Output is correct |
2 |
Correct |
52 ms |
2424 KB |
Output is correct |
3 |
Correct |
91 ms |
2244 KB |
Output is correct |
4 |
Correct |
54 ms |
2244 KB |
Output is correct |
5 |
Correct |
51 ms |
2364 KB |
Output is correct |
6 |
Correct |
50 ms |
2264 KB |
Output is correct |
7 |
Correct |
50 ms |
2372 KB |
Output is correct |
8 |
Correct |
51 ms |
2412 KB |
Output is correct |
9 |
Correct |
48 ms |
2372 KB |
Output is correct |
10 |
Correct |
55 ms |
2316 KB |
Output is correct |
11 |
Correct |
51 ms |
2352 KB |
Output is correct |
12 |
Correct |
55 ms |
2372 KB |
Output is correct |
13 |
Correct |
48 ms |
2372 KB |
Output is correct |
14 |
Correct |
51 ms |
2396 KB |
Output is correct |
15 |
Correct |
48 ms |
2364 KB |
Output is correct |
16 |
Correct |
52 ms |
2452 KB |
Output is correct |
17 |
Correct |
54 ms |
2416 KB |
Output is correct |
18 |
Correct |
90 ms |
2276 KB |
Output is correct |
19 |
Correct |
58 ms |
2244 KB |
Output is correct |
20 |
Correct |
102 ms |
2252 KB |
Output is correct |
21 |
Correct |
52 ms |
2372 KB |
Output is correct |
22 |
Correct |
44 ms |
2112 KB |
Output is correct |
23 |
Correct |
53 ms |
2372 KB |
Output is correct |
24 |
Correct |
52 ms |
2252 KB |
Output is correct |
25 |
Correct |
53 ms |
2400 KB |
Output is correct |
26 |
Correct |
52 ms |
2268 KB |
Output is correct |
27 |
Correct |
52 ms |
2376 KB |
Output is correct |
28 |
Correct |
49 ms |
2116 KB |
Output is correct |
29 |
Correct |
51 ms |
2432 KB |
Output is correct |
30 |
Correct |
51 ms |
2216 KB |
Output is correct |
31 |
Correct |
59 ms |
2372 KB |
Output is correct |
32 |
Correct |
59 ms |
2368 KB |
Output is correct |
33 |
Correct |
53 ms |
2388 KB |
Output is correct |
34 |
Correct |
48 ms |
2244 KB |
Output is correct |
35 |
Correct |
54 ms |
2372 KB |
Output is correct |
36 |
Correct |
55 ms |
2340 KB |
Output is correct |
37 |
Correct |
59 ms |
2372 KB |
Output is correct |
38 |
Correct |
58 ms |
2376 KB |
Output is correct |
39 |
Correct |
60 ms |
2320 KB |
Output is correct |
40 |
Correct |
52 ms |
2432 KB |
Output is correct |
41 |
Correct |
55 ms |
2396 KB |
Output is correct |
42 |
Correct |
55 ms |
2372 KB |
Output is correct |
43 |
Correct |
51 ms |
2280 KB |
Output is correct |
44 |
Correct |
54 ms |
2360 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
47 ms |
820 KB |
Output is correct |
2 |
Correct |
52 ms |
2424 KB |
Output is correct |
3 |
Correct |
91 ms |
2244 KB |
Output is correct |
4 |
Correct |
54 ms |
2244 KB |
Output is correct |
5 |
Correct |
51 ms |
2364 KB |
Output is correct |
6 |
Correct |
50 ms |
2264 KB |
Output is correct |
7 |
Correct |
50 ms |
2372 KB |
Output is correct |
8 |
Correct |
51 ms |
2412 KB |
Output is correct |
9 |
Correct |
48 ms |
2372 KB |
Output is correct |
10 |
Correct |
55 ms |
2316 KB |
Output is correct |
11 |
Correct |
51 ms |
2352 KB |
Output is correct |
12 |
Correct |
55 ms |
2372 KB |
Output is correct |
13 |
Correct |
48 ms |
2372 KB |
Output is correct |
14 |
Correct |
51 ms |
2396 KB |
Output is correct |
15 |
Correct |
48 ms |
2364 KB |
Output is correct |
16 |
Correct |
52 ms |
2452 KB |
Output is correct |
17 |
Correct |
54 ms |
2416 KB |
Output is correct |
18 |
Correct |
90 ms |
2276 KB |
Output is correct |
19 |
Execution timed out |
7050 ms |
4184 KB |
Time limit exceeded |
20 |
Halted |
0 ms |
0 KB |
- |