結果
問題 | No.856 増える演算 |
ユーザー | convexineq |
提出日時 | 2021-04-03 17:03:29 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 571 ms / 3,153 ms |
コード長 | 1,425 bytes |
コンパイル時間 | 292 ms |
コンパイル使用メモリ | 82,048 KB |
実行使用メモリ | 182,652 KB |
最終ジャッジ日時 | 2024-06-07 03:59:19 |
合計ジャッジ時間 | 36,502 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 344 ms
174,096 KB |
testcase_01 | AC | 344 ms
174,096 KB |
testcase_02 | AC | 346 ms
173,844 KB |
testcase_03 | AC | 344 ms
173,848 KB |
testcase_04 | AC | 372 ms
174,228 KB |
testcase_05 | AC | 351 ms
174,104 KB |
testcase_06 | AC | 361 ms
173,968 KB |
testcase_07 | AC | 349 ms
174,360 KB |
testcase_08 | AC | 353 ms
173,848 KB |
testcase_09 | AC | 348 ms
174,092 KB |
testcase_10 | AC | 344 ms
174,100 KB |
testcase_11 | AC | 345 ms
173,844 KB |
testcase_12 | AC | 342 ms
173,848 KB |
testcase_13 | AC | 347 ms
174,096 KB |
testcase_14 | AC | 348 ms
173,968 KB |
testcase_15 | AC | 344 ms
174,100 KB |
testcase_16 | AC | 351 ms
174,136 KB |
testcase_17 | AC | 346 ms
174,100 KB |
testcase_18 | AC | 348 ms
173,840 KB |
testcase_19 | AC | 345 ms
174,100 KB |
testcase_20 | AC | 341 ms
173,980 KB |
testcase_21 | AC | 345 ms
174,356 KB |
testcase_22 | AC | 348 ms
174,228 KB |
testcase_23 | AC | 361 ms
174,188 KB |
testcase_24 | AC | 358 ms
174,220 KB |
testcase_25 | AC | 358 ms
174,020 KB |
testcase_26 | AC | 345 ms
173,840 KB |
testcase_27 | AC | 343 ms
174,096 KB |
testcase_28 | AC | 355 ms
174,316 KB |
testcase_29 | AC | 357 ms
174,180 KB |
testcase_30 | AC | 358 ms
174,176 KB |
testcase_31 | AC | 354 ms
174,288 KB |
testcase_32 | AC | 365 ms
174,324 KB |
testcase_33 | AC | 364 ms
173,996 KB |
testcase_34 | AC | 379 ms
174,904 KB |
testcase_35 | AC | 370 ms
174,480 KB |
testcase_36 | AC | 375 ms
174,492 KB |
testcase_37 | AC | 386 ms
174,704 KB |
testcase_38 | AC | 360 ms
174,404 KB |
testcase_39 | AC | 362 ms
174,304 KB |
testcase_40 | AC | 366 ms
174,196 KB |
testcase_41 | AC | 363 ms
174,304 KB |
testcase_42 | AC | 375 ms
174,588 KB |
testcase_43 | AC | 374 ms
174,708 KB |
testcase_44 | AC | 348 ms
174,096 KB |
testcase_45 | AC | 363 ms
174,412 KB |
testcase_46 | AC | 355 ms
174,060 KB |
testcase_47 | AC | 363 ms
174,700 KB |
testcase_48 | AC | 374 ms
174,416 KB |
testcase_49 | AC | 360 ms
174,000 KB |
testcase_50 | AC | 382 ms
174,656 KB |
testcase_51 | AC | 379 ms
175,132 KB |
testcase_52 | AC | 378 ms
174,556 KB |
testcase_53 | AC | 482 ms
175,248 KB |
testcase_54 | AC | 428 ms
174,600 KB |
testcase_55 | AC | 472 ms
175,328 KB |
testcase_56 | AC | 423 ms
174,280 KB |
testcase_57 | AC | 485 ms
175,084 KB |
testcase_58 | AC | 446 ms
175,220 KB |
testcase_59 | AC | 525 ms
182,220 KB |
testcase_60 | AC | 441 ms
174,908 KB |
testcase_61 | AC | 524 ms
182,652 KB |
testcase_62 | AC | 506 ms
182,136 KB |
testcase_63 | AC | 366 ms
174,160 KB |
testcase_64 | AC | 494 ms
182,084 KB |
testcase_65 | AC | 443 ms
174,060 KB |
testcase_66 | AC | 432 ms
174,880 KB |
testcase_67 | AC | 455 ms
175,064 KB |
testcase_68 | AC | 511 ms
182,204 KB |
testcase_69 | AC | 502 ms
182,064 KB |
testcase_70 | AC | 513 ms
182,100 KB |
testcase_71 | AC | 507 ms
181,980 KB |
testcase_72 | AC | 481 ms
174,924 KB |
testcase_73 | AC | 535 ms
181,572 KB |
testcase_74 | AC | 532 ms
181,840 KB |
testcase_75 | AC | 541 ms
181,712 KB |
testcase_76 | AC | 526 ms
181,712 KB |
testcase_77 | AC | 571 ms
181,452 KB |
testcase_78 | AC | 545 ms
181,340 KB |
testcase_79 | AC | 542 ms
181,584 KB |
testcase_80 | AC | 532 ms
181,580 KB |
testcase_81 | AC | 531 ms
181,464 KB |
testcase_82 | AC | 451 ms
179,276 KB |
ソースコード
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)