TopCoder

User's AC Ratio

100.0% (2/2)

Submission's AC Ratio

100.0% (3/3)

Tags

Description

Input Format

Output Format

Sample Input 1

3 4
110
1 2 B
1 2 R
1 3 G
2 3 G

Sample Output 1

Yes
BRG

Sample Input 2

5 7
11001
1 3 B
1 4 R
2 3 B
2 4 G
2 5 G
3 5 R
4 5 B

Sample Output 2

No

Sample Input 3

5 6
11111
1 2 B
1 4 R
1 3 R
1 5 B
2 3 B
3 5 G

Sample Output 3

Yes
BBRRR

Hints

Problem Source

YTP 2022 高中組程式挑戰營 p14

Subtasks

No. Testdata Range Constraints Score
1 0~2 範例測資 0
2 0~8 $N \leq 10, M \leq 50$ 4
3 9~29 $S$ 的每個字元都是 1 8
4 0~66 無額外限制 13

Testdata and Limits

No. Time Limit (ms) Memory Limit (VSS, KiB) Output Limit (KiB) Subtasks
0 3000 524288 65536 1 2 4
1 3000 524288 65536 1 2 4
2 3000 524288 65536 1 2 4
3 3000 524288 65536 2 4
4 3000 524288 65536 2 4
5 3000 524288 65536 2 4
6 3000 524288 65536 2 4
7 3000 524288 65536 2 4
8 3000 524288 65536 2 4
9 3000 524288 65536 3 4
10 3000 524288 65536 3 4
11 3000 524288 65536 3 4
12 3000 524288 65536 3 4
13 3000 524288 65536 3 4
14 3000 524288 65536 3 4
15 3000 524288 65536 3 4
16 3000 524288 65536 3 4
17 3000 524288 65536 3 4
18 3000 524288 65536 3 4
19 3000 524288 65536 3 4
20 3000 524288 65536 3 4
21 3000 524288 65536 3 4
22 3000 524288 65536 3 4
23 3000 524288 65536 3 4
24 3000 524288 65536 3 4
25 3000 524288 65536 3 4
26 3000 524288 65536 3 4
27 3000 524288 65536 3 4
28 3000 524288 65536 3 4
29 3000 524288 65536 3 4
30 3000 524288 65536 4
31 3000 524288 65536 4
32 3000 524288 65536 4
33 3000 524288 65536 4
34 3000 524288 65536 4
35 3000 524288 65536 4
36 3000 524288 65536 4
37 3000 524288 65536 4
38 3000 524288 65536 4
39 3000 524288 65536 4
40 3000 524288 65536 4
41 3000 524288 65536 4
42 3000 524288 65536 4
43 3000 524288 65536 4
44 3000 524288 65536 4
45 3000 524288 65536 4
46 3000 524288 65536 4
47 3000 524288 65536 4
48 3000 524288 65536 4
49 3000 524288 65536 4
50 3000 524288 65536 4
51 3000 524288 65536 4
52 3000 524288 65536 4
53 3000 524288 65536 4
54 3000 524288 65536 4
55 3000 524288 65536 4
56 3000 524288 65536 4
57 3000 524288 65536 4
58 3000 524288 65536 4
59 3000 524288 65536 4
60 3000 524288 65536 4
61 3000 524288 65536 4
62 3000 524288 65536 4
63 3000 524288 65536 4
64 3000 524288 65536 4
65 3000 524288 65536 4
66 3000 524288 65536 4