def popcountll(i): i -= (i >> 1) & 0x5555555555555555 i = (i & 0x3333333333333333) + ((i >> 2) & 0x3333333333333333) i = (i & 0x0F0F0F0F0F0F0F0F) + ((i>>4) & 0x0F0F0F0F0F0F0F0F) i = (i>>32) + (i & 0xFFFFFFFF) return ((i * 0x1010101) & 0xffffffff) >> 24 def popcount128(i): return popcountll(i>>62) + popcountll(i&0x3FFFFFFFFFFFFFFF) def maximum_clique_BK(G): def dfs(R, P, cnt): nonlocal ans,val if popcount(P)+cnt <= val: return # 枝刈り if P==0: if val < cnt: val = cnt ans = R return PP = P&~g[(P&-P).bit_length() - 1] while PP: v = PP&-PP vv = v.bit_length() - 1 dfs(R|v, P&g[vv], cnt+1) P ^= v PP ^= v n = len(G) #assert n <= 63 N = 1<= p: g[i][j] = g[j][i] = 1 ans, val = maximum_clique_BK(g) print(val+1) ans = [i+1 for i,c in enumerate(bin(ans)[2:][::-1]) if c == "1"] print(*ans)