結果

問題 No.983 Convolution
ユーザー vwxyzvwxyz
提出日時 2021-09-15 13:31:59
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
TLE  
実行時間 -
コード長 1,075 bytes
コンパイル時間 155 ms
コンパイル使用メモリ 11,004 KB
実行使用メモリ 29,400 KB
最終ジャッジ日時 2023-09-10 22:58:38
合計ジャッジ時間 38,814 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 33 ms
10,480 KB
testcase_01 AC 33 ms
10,432 KB
testcase_02 AC 33 ms
10,496 KB
testcase_03 AC 1,607 ms
23,032 KB
testcase_04 AC 1,268 ms
20,868 KB
testcase_05 AC 1,188 ms
18,632 KB
testcase_06 AC 1,792 ms
24,156 KB
testcase_07 AC 1,856 ms
23,608 KB
testcase_08 AC 344 ms
12,820 KB
testcase_09 AC 718 ms
14,984 KB
testcase_10 AC 218 ms
12,772 KB
testcase_11 AC 359 ms
13,808 KB
testcase_12 TLE -
testcase_13 AC 598 ms
16,068 KB
testcase_14 AC 732 ms
15,924 KB
testcase_15 AC 1,651 ms
22,168 KB
testcase_16 AC 1,200 ms
18,192 KB
testcase_17 TLE -
testcase_18 AC 307 ms
12,436 KB
testcase_19 AC 1,104 ms
19,120 KB
testcase_20 TLE -
testcase_21 AC 1,665 ms
23,304 KB
testcase_22 AC 387 ms
13,400 KB
testcase_23 AC 1,475 ms
20,204 KB
testcase_24 AC 360 ms
12,840 KB
testcase_25 AC 280 ms
12,232 KB
testcase_26 AC 927 ms
16,660 KB
testcase_27 AC 717 ms
15,344 KB
testcase_28 AC 1,144 ms
19,884 KB
testcase_29 TLE -
testcase_30 AC 1,213 ms
19,828 KB
testcase_31 AC 621 ms
15,364 KB
testcase_32 AC 1,259 ms
21,080 KB
testcase_33 AC 34 ms
10,520 KB
testcase_34 AC 33 ms
10,352 KB
testcase_35 AC 34 ms
10,452 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import bisect
import copy
import decimal
import fractions
import functools
import heapq
import itertools
import math
import random
import sys
from collections import Counter,deque,defaultdict
from functools import lru_cache,reduce
from heapq import heappush,heappop,heapify,heappushpop,_heappop_max,_heapify_max
def _heappush_max(heap,item):
    heap.append(item)
    heapq._siftdown_max(heap, 0, len(heap)-1)
def _heappushpop_max(heap, item):
    if heap and item < heap[0]:
        item, heap[0] = heap[0], item
        heapq._siftup_max(heap, 0)
    return item
from math import degrees, gcd as GCD
read=sys.stdin.read
readline=sys.stdin.readline
readlines=sys.stdin.readlines

N=int(readline())
A=list(map(int,readline().split()))
for i in range(N):
    if A[i]==-1:
        A[i]=0
for bit in range(30):
    for i in range(N-1,-1,-1):
        if i>>bit&1:
            A[i^1<<bit]+=A[i]
for i in range(N):
    A[i]**=2
for bit in range(30):
    for i in range(N):
        if i>>bit&1:
            A[i^1<<bit]-=A[i]
g=0
for a in A:
    g=GCD(g,a)
if g==0:
    g=-1
print(g)
0