当前你的浏览器版本过低,网站已在兼容模式下运行,兼容模式仅提供最小功能支持,网站样式可能显示不正常。
请尽快升级浏览器以体验网站在线编辑、在线运行等功能。
一个大小为m的轮盘,上面有a个白棋子,b个黑棋子。
白棋先行,每次可以走到一个中间没有任何棋子的位
。例如下图中,8号棋子可以走到1、7、9-个位置。

哪方先不能移动就输。问哪方能赢,或者判断游戏永远
无法结束。
1 < =M<= 1000000000,1<=a+b<= 1000000。
The first line of the standard input contains one integer t representing the number of boards to be considered. The following lines contain descriptions of respective boards, each of which consists of three lines. In the first line there are three integers m, b and c (1<=M<=10^9,1<=b,c) separated by single spaces and denoting the length of the board, the number of white pieces and the number of black pieces. In the second line there is an increasing sequence of b integers (in the range 1……m) representing the positions of white pieces. In the third line there is an increasing sequence of integers (in the range 1……m) representing the positions of black pieces. The total number of pieces in all boards does not exceed 10^6.
Exactly lines with answers for consecutive boards should be written to the standard output. The answer is always a single character: B, C, or R, depending on whether the white player wins (B), the black player wins (C) or the game never ends (R).
3 9 2 3 3 8 2 5 6 6 2 2 5 6 2 4 7 1 1 3 4
C B R
| bzoj_id | 3497 |
| import_source_sha256 | 0baac55018ae8c90ed6e9fc5374b98b564939809f089191d4d0cd9d8d1ee6062 |
| bzoj_checker_pending | False |
| 时间上限 | 内存上限 |
| 10000 MS | 128 MB |