結果

問題 No.983 Convolution
ユーザー titiatitia
提出日時 2020-02-11 14:54:47
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 463 bytes
コンパイル時間 160 ms
コンパイル使用メモリ 11,904 KB
実行使用メモリ 28,952 KB
最終ジャッジ日時 2024-04-08 15:13:59
合計ジャッジ時間 18,227 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 33 ms
10,112 KB
testcase_01 AC 31 ms
10,240 KB
testcase_02 AC 33 ms
10,240 KB
testcase_03 AC 674 ms
22,508 KB
testcase_04 AC 553 ms
20,520 KB
testcase_05 AC 477 ms
18,456 KB
testcase_06 AC 793 ms
23,628 KB
testcase_07 AC 758 ms
23,328 KB
testcase_08 AC 157 ms
12,672 KB
testcase_09 WA -
testcase_10 AC 109 ms
11,904 KB
testcase_11 AC 182 ms
13,124 KB
testcase_12 AC 957 ms
26,600 KB
testcase_13 AC 270 ms
14,748 KB
testcase_14 AC 324 ms
15,608 KB
testcase_15 WA -
testcase_16 AC 493 ms
18,640 KB
testcase_17 WA -
testcase_18 AC 149 ms
12,544 KB
testcase_19 AC 471 ms
18,776 KB
testcase_20 AC 978 ms
25,716 KB
testcase_21 AC 681 ms
23,004 KB
testcase_22 AC 175 ms
13,056 KB
testcase_23 AC 644 ms
20,596 KB
testcase_24 AC 164 ms
12,160 KB
testcase_25 AC 143 ms
11,776 KB
testcase_26 AC 433 ms
16,500 KB
testcase_27 AC 329 ms
14,700 KB
testcase_28 AC 800 ms
19,472 KB
testcase_29 AC 1,625 ms
28,952 KB
testcase_30 AC 807 ms
19,464 KB
testcase_31 AC 442 ms
15,200 KB
testcase_32 AC 897 ms
20,656 KB
testcase_33 AC 30 ms
10,112 KB
testcase_34 AC 31 ms
10,240 KB
testcase_35 AC 31 ms
10,240 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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