結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 31 ms
10,112 KB
testcase_01 AC 33 ms
10,240 KB
testcase_02 AC 30 ms
10,240 KB
testcase_03 AC 663 ms
22,512 KB
testcase_04 AC 580 ms
20,520 KB
testcase_05 AC 483 ms
18,456 KB
testcase_06 AC 746 ms
23,628 KB
testcase_07 AC 779 ms
23,328 KB
testcase_08 AC 164 ms
12,672 KB
testcase_09 WA -
testcase_10 AC 107 ms
11,904 KB
testcase_11 AC 180 ms
13,124 KB
testcase_12 AC 978 ms
26,600 KB
testcase_13 AC 264 ms
14,748 KB
testcase_14 AC 323 ms
15,608 KB
testcase_15 WA -
testcase_16 AC 489 ms
18,640 KB
testcase_17 WA -
testcase_18 AC 141 ms
12,544 KB
testcase_19 AC 464 ms
18,776 KB
testcase_20 AC 983 ms
25,716 KB
testcase_21 AC 684 ms
23,004 KB
testcase_22 AC 169 ms
12,988 KB
testcase_23 AC 690 ms
20,596 KB
testcase_24 AC 165 ms
12,160 KB
testcase_25 AC 135 ms
11,776 KB
testcase_26 AC 411 ms
16,500 KB
testcase_27 AC 333 ms
14,700 KB
testcase_28 AC 789 ms
19,472 KB
testcase_29 AC 1,618 ms
28,952 KB
testcase_30 AC 798 ms
19,464 KB
testcase_31 AC 438 ms
15,200 KB
testcase_32 AC 910 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 i in range(N):
        if S[i]==-1:
            continue
        ANS=math.gcd(S[i]*A[i],ANS)

    print(ANS)
0