結果

問題 No.1530 Permutation and Popcount
ユーザー convexineqconvexineq
提出日時 2021-06-08 19:00:12
言語 PyPy3
(7.3.13)
結果
AC  
実行時間 124 ms / 2,000 ms
コード長 437 bytes
コンパイル時間 571 ms
コンパイル使用メモリ 87,104 KB
実行使用メモリ 77,048 KB
最終ジャッジ日時 2023-08-16 08:44:22
合計ジャッジ時間 7,409 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 71 ms
71,364 KB
testcase_01 AC 71 ms
71,016 KB
testcase_02 AC 72 ms
71,384 KB
testcase_03 AC 70 ms
71,380 KB
testcase_04 AC 72 ms
71,320 KB
testcase_05 AC 69 ms
71,312 KB
testcase_06 AC 73 ms
71,304 KB
testcase_07 AC 71 ms
71,284 KB
testcase_08 AC 70 ms
71,192 KB
testcase_09 AC 75 ms
71,288 KB
testcase_10 AC 74 ms
71,168 KB
testcase_11 AC 100 ms
77,044 KB
testcase_12 AC 118 ms
76,604 KB
testcase_13 AC 78 ms
76,000 KB
testcase_14 AC 102 ms
76,836 KB
testcase_15 AC 85 ms
76,240 KB
testcase_16 AC 80 ms
76,380 KB
testcase_17 AC 106 ms
76,668 KB
testcase_18 AC 100 ms
76,720 KB
testcase_19 AC 72 ms
71,164 KB
testcase_20 AC 72 ms
71,476 KB
testcase_21 AC 105 ms
76,900 KB
testcase_22 AC 109 ms
77,048 KB
testcase_23 AC 103 ms
76,668 KB
testcase_24 AC 76 ms
76,384 KB
testcase_25 AC 99 ms
76,900 KB
testcase_26 AC 83 ms
76,032 KB
testcase_27 AC 118 ms
76,864 KB
testcase_28 AC 107 ms
76,620 KB
testcase_29 AC 86 ms
76,280 KB
testcase_30 AC 70 ms
71,428 KB
testcase_31 AC 118 ms
76,924 KB
testcase_32 AC 119 ms
76,944 KB
testcase_33 AC 120 ms
76,904 KB
testcase_34 AC 118 ms
76,964 KB
testcase_35 AC 121 ms
76,940 KB
testcase_36 AC 119 ms
76,896 KB
testcase_37 AC 118 ms
77,036 KB
testcase_38 AC 121 ms
76,740 KB
testcase_39 AC 119 ms
76,748 KB
testcase_40 AC 121 ms
77,028 KB
testcase_41 AC 123 ms
76,564 KB
testcase_42 AC 124 ms
76,744 KB
testcase_43 AC 110 ms
76,776 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n,m = map(int,input().split())
L = [sum(1-bin(i*j).count("1")%2 for j in range(1,n+1)) for i in range(1,n+1)]
v = 1
dp = [1]
for i in L:
    v |= v<<i
    dp.append(v)
m += sum(L)
if m%2 or dp[-1]>>(m//2)&1==0:
    print(-1)
    exit()
m //= 2
P = []
Q = []
for i,v in enumerate(L[::-1]):
    if m < v or dp[n-i-1]>>(m-v)&1==0:
        Q.append(n-i)
    else:
        P.append(n-i)
        m -= v
print(len(P),len(Q))
print(*P)
print(*Q)
0