检查出队时要先减计数,再head++!
即:
while(cnt[Q[head].id] > 1) cnt[Q[head++].id]--;
不要写成:
while(cnt[Q[head].id] > 1) cnt[Q[++head].id]--;
应该没有人像我这么蠢