結果

問題 No.3491 右結合的総乗
コンテスト
ユーザー shogo314
提出日時 2026-04-03 22:14:33
言語 PyPy3
(7.3.17)
コンパイル:
pypy3 -mpy_compile _filename_
実行:
pypy3 _filename_
結果
WA  
実行時間 -
コード長 504 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 276 ms
コンパイル使用メモリ 85,492 KB
実行使用メモリ 81,404 KB
最終ジャッジ日時 2026-04-03 22:14:42
合計ジャッジ時間 2,900 ms
ジャッジサーバーID
(参考情報)
judge2_0 / judge3_1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 25 WA * 15
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

N, M = map(int, input().split())
A = list(map(int, input().split()))
S = list(map(int, input().split()))
T = 0
X = 0
for s in S:
    T |= 1 << s
while S:
    U = 0
    for s in S:
        U |= T << s
    S = []
    for i in range(2 * N + 1):
        if (X >> i) & 1:
            continue
        if not (U >> i) & 1:
            continue
        X |= 1 << i
        if (T >> A[i]) & 1:
            continue
        T |= 1 << A[i]
        S.append(A[i])
print(sum(1 & (T >> i) for i in range(2 * N + 1)))
0