結果
| 問題 | 
                            No.983 Convolution
                             | 
                    
| コンテスト | |
| ユーザー | 
                             titia
                         | 
                    
| 提出日時 | 2020-02-11 14:54:47 | 
| 言語 | Python3  (3.13.1 + numpy 2.2.1 + scipy 1.14.1)  | 
                    
| 結果 | 
                             
                                WA
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 463 bytes | 
| コンパイル時間 | 77 ms | 
| コンパイル使用メモリ | 12,544 KB | 
| 実行使用メモリ | 29,652 KB | 
| 最終ジャッジ日時 | 2024-10-01 07:47:20 | 
| 合計ジャッジ時間 | 18,074 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge5 / judge2 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 30 WA * 3 | 
ソースコード
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)
            
            
            
        
            
titia