TopCoder

000000
Caidorz

User's AC Ratio

85.2% (23/27)

Submission's AC Ratio

35.3% (30/85)

Tags

Description

Input Format

Output Format

Sample Input 1

3
17 3
RPRRSSRSSRPSRPPRP
18 3
RRPRPPPRSSSSPRPSRS
3 1
RPS

Sample Output 1

2
PRP
3
RPR
-1
impossible

Hints

Problem Source

110 學年度全國資訊學科能力競賽模擬賽

Subtasks

No. Testdata Range Constraints Score
1 0 範例測資 0
2 1~3 $N \le 100, M = 1$ 6
3 0~5 $N \le 100, M \le 8$ 8
4 0~7 $N \le 1000$ 39
5 0~11 無額外限制 47

Testdata and Limits

No. Time Limit (ms) Memory Limit (VSS, KiB) Output Limit (KiB) Subtasks
0 3000 524288 65536 1 3 4 5
1 3000 524288 65536 2 3 4 5
2 3000 524288 65536 2 3 4 5
3 3000 524288 65536 2 3 4 5
4 3000 524288 65536 3 4 5
5 3000 524288 65536 3 4 5
6 3000 524288 65536 4 5
7 3000 524288 65536 4 5
8 3000 524288 65536 5
9 3000 524288 65536 5
10 3000 524288 65536 5
11 3000 524288 65536 5