結果

問題 No.983 Convolution
コンテスト
ユーザー titia
提出日時 2020-02-11 14:54:47
言語 Python3
(3.14.3 + numpy 2.4.4 + scipy 1.17.1)
コンパイル:
python3 -mpy_compile _filename_
実行:
python3 _filename_
結果
WA  
実行時間 -
コード長 463 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 662 ms
コンパイル使用メモリ 20,828 KB
実行使用メモリ 32,884 KB
最終ジャッジ日時 2026-04-17 08:04:21
合計ジャッジ時間 15,261 ms
ジャッジサーバーID
(参考情報)
judge3_0 / judge1_1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 30 WA * 3
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

N=int(input())
A=list(map(int,input().split()))

import copy
S=copy.deepcopy(A)

for i in range(N-1,-1,-1):
    for j in range(19):
        if i & (1<<j)!=0:
            if S[i]==-1:
                S[i^(1<<j)]=-1
            elif S[i]!=-1 and S[i^(1<<j)]!=-1:
                S[i^(1<<j)]+=S[i]

if max(S)==-1:
    print(-1)
else:    
    import math
    ANS=0
    for s in S:
        if s==-1:
            continue
        ANS=math.gcd(s**2,ANS)

    print(ANS)
0