結果

問題 No.856 増える演算
ユーザー convexineqconvexineq
提出日時 2021-04-03 16:59:47
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 1,426 bytes
コンパイル時間 810 ms
コンパイル使用メモリ 86,904 KB
実行使用メモリ 182,908 KB
最終ジャッジ日時 2023-08-26 08:38:27
合計ジャッジ時間 37,351 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 355 ms
174,632 KB
testcase_01 AC 394 ms
174,896 KB
testcase_02 AC 333 ms
175,060 KB
testcase_03 AC 334 ms
174,732 KB
testcase_04 WA -
testcase_05 AC 336 ms
174,908 KB
testcase_06 AC 342 ms
174,952 KB
testcase_07 AC 333 ms
175,048 KB
testcase_08 WA -
testcase_09 WA -
testcase_10 AC 336 ms
175,260 KB
testcase_11 WA -
testcase_12 AC 334 ms
174,808 KB
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 AC 354 ms
174,996 KB
testcase_20 WA -
testcase_21 WA -
testcase_22 AC 343 ms
174,908 KB
testcase_23 AC 360 ms
175,352 KB
testcase_24 AC 364 ms
175,120 KB
testcase_25 AC 354 ms
175,188 KB
testcase_26 WA -
testcase_27 AC 345 ms
175,104 KB
testcase_28 AC 353 ms
174,948 KB
testcase_29 AC 357 ms
175,008 KB
testcase_30 WA -
testcase_31 AC 348 ms
175,024 KB
testcase_32 AC 353 ms
175,052 KB
testcase_33 WA -
testcase_34 WA -
testcase_35 AC 363 ms
175,736 KB
testcase_36 AC 367 ms
175,660 KB
testcase_37 WA -
testcase_38 AC 355 ms
175,200 KB
testcase_39 AC 353 ms
175,424 KB
testcase_40 WA -
testcase_41 AC 351 ms
174,952 KB
testcase_42 AC 386 ms
175,564 KB
testcase_43 WA -
testcase_44 WA -
testcase_45 WA -
testcase_46 WA -
testcase_47 WA -
testcase_48 WA -
testcase_49 AC 353 ms
175,120 KB
testcase_50 WA -
testcase_51 AC 375 ms
182,212 KB
testcase_52 AC 371 ms
175,784 KB
testcase_53 WA -
testcase_54 WA -
testcase_55 AC 457 ms
182,348 KB
testcase_56 WA -
testcase_57 AC 466 ms
182,456 KB
testcase_58 AC 446 ms
182,572 KB
testcase_59 AC 498 ms
181,812 KB
testcase_60 AC 412 ms
175,672 KB
testcase_61 AC 493 ms
181,684 KB
testcase_62 WA -
testcase_63 AC 360 ms
175,072 KB
testcase_64 AC 470 ms
182,464 KB
testcase_65 WA -
testcase_66 AC 415 ms
175,660 KB
testcase_67 WA -
testcase_68 AC 476 ms
182,692 KB
testcase_69 AC 476 ms
182,860 KB
testcase_70 WA -
testcase_71 AC 482 ms
182,224 KB
testcase_72 WA -
testcase_73 AC 515 ms
180,228 KB
testcase_74 WA -
testcase_75 WA -
testcase_76 WA -
testcase_77 WA -
testcase_78 WA -
testcase_79 AC 520 ms
180,380 KB
testcase_80 AC 514 ms
180,084 KB
testcase_81 AC 518 ms
180,112 KB
testcase_82 AC 438 ms
178,676 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,a[n-1],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