結果
問題 | No.856 増える演算 |
ユーザー | convexineq |
提出日時 | 2021-04-03 16:21:26 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,719 bytes |
コンパイル時間 | 213 ms |
コンパイル使用メモリ | 82,688 KB |
実行使用メモリ | 97,920 KB |
最終ジャッジ日時 | 2024-06-07 02:17:26 |
合計ジャッジ時間 | 19,597 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 151 ms
79,992 KB |
testcase_01 | AC | 165 ms
79,996 KB |
testcase_02 | AC | 154 ms
79,996 KB |
testcase_03 | AC | 151 ms
79,996 KB |
testcase_04 | AC | 155 ms
80,120 KB |
testcase_05 | AC | 155 ms
80,120 KB |
testcase_06 | AC | 153 ms
80,248 KB |
testcase_07 | AC | 155 ms
80,380 KB |
testcase_08 | AC | 157 ms
80,508 KB |
testcase_09 | AC | 154 ms
80,252 KB |
testcase_10 | AC | 151 ms
80,248 KB |
testcase_11 | AC | 157 ms
80,256 KB |
testcase_12 | AC | 156 ms
80,244 KB |
testcase_13 | AC | 158 ms
80,124 KB |
testcase_14 | AC | 157 ms
79,992 KB |
testcase_15 | AC | 154 ms
79,996 KB |
testcase_16 | AC | 154 ms
80,000 KB |
testcase_17 | AC | 155 ms
80,000 KB |
testcase_18 | AC | 154 ms
80,380 KB |
testcase_19 | AC | 158 ms
80,380 KB |
testcase_20 | AC | 159 ms
79,992 KB |
testcase_21 | AC | 155 ms
79,996 KB |
testcase_22 | AC | 154 ms
80,132 KB |
testcase_23 | AC | 165 ms
80,336 KB |
testcase_24 | AC | 170 ms
80,492 KB |
testcase_25 | AC | 169 ms
80,304 KB |
testcase_26 | AC | 159 ms
80,128 KB |
testcase_27 | AC | 159 ms
79,992 KB |
testcase_28 | AC | 168 ms
80,592 KB |
testcase_29 | AC | 165 ms
80,212 KB |
testcase_30 | AC | 165 ms
80,332 KB |
testcase_31 | AC | 160 ms
80,176 KB |
testcase_32 | AC | 163 ms
80,240 KB |
testcase_33 | AC | 174 ms
80,268 KB |
testcase_34 | AC | 183 ms
82,688 KB |
testcase_35 | AC | 180 ms
80,784 KB |
testcase_36 | AC | 182 ms
82,524 KB |
testcase_37 | AC | 176 ms
82,112 KB |
testcase_38 | AC | 164 ms
80,308 KB |
testcase_39 | AC | 163 ms
80,196 KB |
testcase_40 | AC | 166 ms
80,492 KB |
testcase_41 | AC | 170 ms
80,324 KB |
testcase_42 | AC | 182 ms
82,688 KB |
testcase_43 | AC | 169 ms
80,368 KB |
testcase_44 | AC | 154 ms
80,252 KB |
testcase_45 | AC | 163 ms
80,564 KB |
testcase_46 | AC | 166 ms
80,464 KB |
testcase_47 | AC | 162 ms
80,604 KB |
testcase_48 | AC | 171 ms
81,520 KB |
testcase_49 | AC | 168 ms
80,244 KB |
testcase_50 | AC | 178 ms
82,052 KB |
testcase_51 | AC | 181 ms
83,064 KB |
testcase_52 | AC | 185 ms
82,944 KB |
testcase_53 | AC | 264 ms
87,936 KB |
testcase_54 | AC | 225 ms
82,136 KB |
testcase_55 | AC | 272 ms
86,528 KB |
testcase_56 | AC | 220 ms
81,400 KB |
testcase_57 | AC | 272 ms
87,680 KB |
testcase_58 | AC | 248 ms
84,736 KB |
testcase_59 | AC | 299 ms
92,032 KB |
testcase_60 | AC | 233 ms
83,072 KB |
testcase_61 | AC | 303 ms
93,440 KB |
testcase_62 | AC | 297 ms
90,624 KB |
testcase_63 | AC | 175 ms
80,300 KB |
testcase_64 | AC | 280 ms
89,088 KB |
testcase_65 | AC | 213 ms
80,360 KB |
testcase_66 | AC | 236 ms
83,456 KB |
testcase_67 | AC | 257 ms
85,376 KB |
testcase_68 | AC | 288 ms
90,624 KB |
testcase_69 | AC | 286 ms
90,240 KB |
testcase_70 | AC | 317 ms
93,824 KB |
testcase_71 | AC | 298 ms
91,776 KB |
testcase_72 | AC | 279 ms
88,960 KB |
testcase_73 | AC | 330 ms
96,000 KB |
testcase_74 | AC | 326 ms
95,872 KB |
testcase_75 | AC | 330 ms
96,128 KB |
testcase_76 | AC | 326 ms
96,000 KB |
testcase_77 | AC | 318 ms
96,000 KB |
testcase_78 | AC | 323 ms
95,872 KB |
testcase_79 | AC | 327 ms
96,128 KB |
testcase_80 | AC | 334 ms
96,128 KB |
testcase_81 | AC | 327 ms
96,000 KB |
testcase_82 | WA | - |
ソースコード
ROOT = 3 MOD = 998244353 roots = [pow(ROOT,(MOD-1)>>i,MOD) for i in range(24)] # 1 の 2^i 乗根 iroots = [pow(x,MOD-2,MOD) for x in roots] # 1 の 2^i 乗根の逆元 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])%MOD, (a[s+p]-a[s+p+m])*w_N%MOD w_N = w_N*roots[n-i]%MOD 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)%MOD, (a[s+p]-a[s+p+m]*w_N)%MOD w_N = w_N*iroots[i+1]%MOD inv = pow((MOD+1)//2,n,MOD) for i in range(1<<n): a[i] = a[i]*inv%MOD def pow2(a): la = len(a) deg = 2*la-2 n = deg.bit_length() N = 1<<n a += [0]*(N-len(a)) #b += [0]*(N-len(b)) untt(a,n) #untt(b,n) for i in range(N): a[i] = a[i]*a[i]%MOD iuntt(a,n) return a[:deg+1] n = int(input()) *a, = map(int,input().split()) M = 10**5+1 v = [0]*M for ai in a: v[ai] += 1 res = pow2(v) for ai in a: res[2*ai] -= 1 MOD2 = 10**9+7 ans = 1 for i,ri in enumerate(res): ans *= pow(i,ri//2,MOD2) ans %= MOD2 v = 0 for ai in a[::-1]: ans *= pow(ai,v,MOD2) ans %= MOD2 v += ai L = R = -1 v = 1e18 rmin = n-1 from math import log for i in range(n-1)[::-1]: w = a[rmin]*log(a[i]) + log(a[i] + a[rmin]) if w < v: L = i R = rmin v = w if a[i] < a[rmin]: rmin = i v = (a[L]+a[R])*pow(a[L],a[R],MOD2)%MOD2 print(ans*pow(v,MOD2-2,MOD2)%MOD2)