第一遍看的时候立即想到了哈希表. 再想时觉得两个队列,一个用来排队伍之间的顺序,一个用来排队伍内部成员的顺序即足够了. DEQUE的时候先判断哪只队伍排在队首,之后再让该队伍中的首队员出列. 整体没有什么难度,注意的一些小tips如下: 1.多个测试用例一定注意先初始化(因为这个wa了两次..呃呃) 2.判断是否需要进行队伍排序可以另立一个flag数组用来标记某支队伍是否已经在队列中,若不在则插入该队伍序号. 3.别忘了按要求输出(最后空一行,否则就PE了) ac代码如下: #include<i…