結果

問題 No.856 増える演算
ユーザー convexineqconvexineq
提出日時 2021-04-03 16:56:57
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 1,421 bytes
コンパイル時間 291 ms
コンパイル使用メモリ 87,320 KB
実行使用メモリ 183,320 KB
最終ジャッジ日時 2023-08-26 08:32:35
合計ジャッジ時間 37,147 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 332 ms
175,200 KB
testcase_02 AC 342 ms
175,304 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 AC 334 ms
175,160 KB
testcase_08 WA -
testcase_09 WA -
testcase_10 AC 343 ms
175,304 KB
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
testcase_30 WA -
testcase_31 WA -
testcase_32 WA -
testcase_33 WA -
testcase_34 AC 367 ms
176,296 KB
testcase_35 AC 364 ms
176,020 KB
testcase_36 WA -
testcase_37 AC 366 ms
175,852 KB
testcase_38 WA -
testcase_39 WA -
testcase_40 AC 348 ms
175,080 KB
testcase_41 AC 349 ms
175,252 KB
testcase_42 WA -
testcase_43 WA -
testcase_44 WA -
testcase_45 WA -
testcase_46 AC 366 ms
175,232 KB
testcase_47 WA -
testcase_48 AC 360 ms
176,156 KB
testcase_49 WA -
testcase_50 AC 354 ms
176,128 KB
testcase_51 AC 365 ms
176,104 KB
testcase_52 WA -
testcase_53 WA -
testcase_54 WA -
testcase_55 WA -
testcase_56 WA -
testcase_57 WA -
testcase_58 WA -
testcase_59 WA -
testcase_60 WA -
testcase_61 WA -
testcase_62 WA -
testcase_63 WA -
testcase_64 WA -
testcase_65 WA -
testcase_66 WA -
testcase_67 WA -
testcase_68 WA -
testcase_69 WA -
testcase_70 WA -
testcase_71 AC 488 ms
182,976 KB
testcase_72 WA -
testcase_73 WA -
testcase_74 AC 509 ms
180,700 KB
testcase_75 WA -
testcase_76 WA -
testcase_77 WA -
testcase_78 WA -
testcase_79 WA -
testcase_80 WA -
testcase_81 WA -
testcase_82 AC 433 ms
178,928 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from math import pi,cos,sin,log

ROOT = 3
roots  = [cos(2*pi/2**i) + sin(2*pi/2**i)*1j for i in range(24)]
iroots  = [cos(2*pi/2**i) - sin(2*pi/2**i)*1j for i in range(24)]

def untt(a,n):
    for i in range(n):
        m = 1<<(n-i-1)
        for s in range(1<<i):
            w_N = 1
            s *= m*2
            for p in range(m):
                a[s+p], a[s+p+m] = (a[s+p]+a[s+p+m]), (a[s+p]-a[s+p+m])*w_N
                w_N *= roots[n-i]

def iuntt(a,n):
    for i in range(n):
        m = 1<<i
        for s in range(1<<(n-i-1)):
            w_N = 1
            s *= m*2
            for p in range(m):
                a[s+p], a[s+p+m] = (a[s+p]+a[s+p+m]*w_N)/2, (a[s+p]-a[s+p+m]*w_N)/2
                w_N *= iroots[i+1]
            
def pow2(a):
    deg = 2*len(a)-2
    n = deg.bit_length()
    N = 1<<n
    a += [0.0]*(N-len(a))
    untt(a,n)
    for i in range(N): a[i] *= a[i]
    iuntt(a,n)
    return a[:deg+1]

n = int(input())
*a, = map(int,input().split())
V = [0.0j]*(10**5+1)
for ai in a: V[ai] += 1
V = pow2(V)
for ai in a: V[2*ai] -= 1
MOD = 10**9+7
ans = 1
for i,vi in enumerate(V):
    ans = ans*pow(i,int(round(vi.real))//2,MOD)%MOD
v = 0
for ai in a[::-1]:
    ans = ans*pow(ai,v,MOD)%MOD
    v += ai

L,R,r,v = 0,0,a[n-1],1e9
for ai in a[n-2::-1]:
    w = R*log(ai) + log(ai+R)
    if w < v:
        L,R,v = ai,r,w
    r = min(r,ai)

v = (L+R)*pow(L,R,MOD)%MOD
print(ans*pow(v,MOD-2,MOD)%MOD)
0