-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path1644A.cpp
36 lines (34 loc) · 871 Bytes
/
1644A.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#include <iostream>
#include <string>
int main()
{
int testcase;
std::cin >> testcase;
while(testcase--)
{
bool key[] = {false, false, false}, passable = true;
std::string hallway;
std::cin >> hallway;
for(int i = 0; i < 6; i++)
{
char step = hallway[i];
if(step == 'r')
key[0] = true;
if(step == 'g')
key[1] = true;
if(step == 'b')
key[2] = true;
if(step == 'R' && !key[0])
passable = false;
if(step == 'G' && !key[1])
passable = false;
if(step == 'B' && !key[2])
passable = false;
}
if(passable)
std::cout << "YES";
else
std::cout << "NO";
std::cout << std::endl;
}
}