发现如果生成了一个 xxx,那么其后面生成的序列是一定的。因此在三个序列中分别记录每个数的首次出现位置即可。直接用桶即可。时间复杂度 O(n)O(n)O(n) 或 O(V)O(V)O(V)。
By signing up a CZOJ universal account, you can submit code and join discussions in all online judging services provided by us.
Using your CZOJ universal account