結果

問題 No.382 シャイな人たち (2)
ユーザー convexineqconvexineq
提出日時 2021-01-10 01:32:36
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 984 bytes
コンパイル時間 182 ms
コンパイル使用メモリ 82,048 KB
実行使用メモリ 111,488 KB
最終ジャッジ日時 2024-04-29 19:51:50
合計ジャッジ時間 18,971 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 TLE -
testcase_01 -- -
testcase_02 -- -
testcase_03 -- -
testcase_04 -- -
testcase_05 -- -
testcase_06 -- -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

def maximum_clique_BK(G):
    def dfs(R, P, cnt):
        nonlocal ans,val
        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<<n
    g = [0]*n
    for a in range(n):
        for b in range(n):
            if G[a][b] == 0 and a != b:
                g[a] ^= 1<<b
    ans = val = 0
    dfs(R=0, P=N-1, cnt=0)
    return ans,val


s = int(input())
MOD = 1000003
s = s*12345%MOD
n = s%120+2
g = [[0]*n for _ in range(n)]
p = s = s*12345%MOD
for i in range(n):
    for j in range(i+1,n):
        s = s*12345%MOD
        if s >= 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)
0