编程介的小学生 2017-04-17 14:55 采纳率: 20.5%
浏览 925
已采纳

Grand Prix

A new season of Touhou M-1 Grand Prix is approaching. Girls in Gensokyo cannot wait for participating it. Before the registration, they have to decide which combination they are going to compete as. Every girl in Gensokyo is either a boke (funny girl) or a tsukomi (straight girl). Every candidate combination is made up of a boke and a tsukomi. A girl may belong to zero or more candidate combinations, but one can only register as a member of one formal combination. The host of Touhou M-1 Grand Prix hopes that as many formal combinations as possible can participate in this year. Under these constraints, some candidate combinations are actually redundant as it's impossible to register it as a formal one as long as the number of formal combinations has to be maximized. So they want to figure out these redundant combinations and stop considering about them.

Input

There are multiple test cases. Process to the End of File.

The first line of each test case contains three integers: 1 ≤ X, Y ≤ 20,000 and 1 ≤ M ≤ 100,000, where X and Y are the number of boke girls and the number of tsukomi girls in Gensokyo, and M is the number of candidate combinations.

The following M lines are M different candidate combinations, one by each line. Each combination is represented by a 6-digit 32-based number, where the first 3 digits represents the index 0 ≤ Bi < X of the boke girl, the last 3 digit represents the index 0 ≤ Ti < Y of the tsukomi girl. A 32-based number uses the 10 decimal digits, '0' through '9', and the first 22 letters of the alphabet, 'A' through 'V', as 32-based digits. For example, 32-based number AVI is 11250 in decimal form.

Output

For each test case, output the number of redundant combinations in the first line. Then output the space-separated zero-based indexes of the redundant combinations in ascending order in the second line.

Sample Input

2 2 3
000001
001001
001000
3 3 6
000000
001000
001001
002000
002001
002002
Sample Output

1
1
3
1 3 4

  • 写回答

1条回答 默认 最新

  • threenewbee 2017-05-01 04:51
    关注
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 Python时间序列如何拟合疏系数模型
  • ¥15 求学软件的前人们指明方向🥺
  • ¥50 如何增强飞上天的树莓派的热点信号强度,以使得笔记本可以在地面实现远程桌面连接
  • ¥20 双层网络上信息-疾病传播
  • ¥50 paddlepaddle pinn
  • ¥20 idea运行测试代码报错问题
  • ¥15 网络监控:网络故障告警通知
  • ¥15 django项目运行报编码错误
  • ¥15 STM32驱动继电器
  • ¥15 Windows server update services