結果
問題 | No.856 増える演算 |
ユーザー | convexineq |
提出日時 | 2021-04-03 16:17:54 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,733 bytes |
コンパイル時間 | 208 ms |
コンパイル使用メモリ | 82,176 KB |
実行使用メモリ | 97,664 KB |
最終ジャッジ日時 | 2024-06-07 02:13:24 |
合計ジャッジ時間 | 20,216 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 158 ms
80,012 KB |
testcase_01 | AC | 161 ms
79,864 KB |
testcase_02 | AC | 162 ms
80,132 KB |
testcase_03 | AC | 161 ms
80,124 KB |
testcase_04 | AC | 153 ms
79,996 KB |
testcase_05 | AC | 151 ms
80,248 KB |
testcase_06 | AC | 150 ms
79,992 KB |
testcase_07 | AC | 154 ms
80,116 KB |
testcase_08 | AC | 153 ms
80,124 KB |
testcase_09 | AC | 156 ms
80,244 KB |
testcase_10 | AC | 148 ms
80,252 KB |
testcase_11 | AC | 149 ms
79,996 KB |
testcase_12 | AC | 152 ms
80,132 KB |
testcase_13 | AC | 152 ms
80,128 KB |
testcase_14 | AC | 154 ms
80,116 KB |
testcase_15 | AC | 155 ms
80,120 KB |
testcase_16 | AC | 154 ms
79,872 KB |
testcase_17 | AC | 153 ms
80,124 KB |
testcase_18 | AC | 153 ms
80,124 KB |
testcase_19 | AC | 149 ms
79,992 KB |
testcase_20 | AC | 151 ms
79,864 KB |
testcase_21 | AC | 153 ms
79,868 KB |
testcase_22 | AC | 160 ms
79,864 KB |
testcase_23 | AC | 167 ms
80,344 KB |
testcase_24 | AC | 162 ms
80,240 KB |
testcase_25 | AC | 159 ms
80,172 KB |
testcase_26 | AC | 158 ms
80,124 KB |
testcase_27 | AC | 154 ms
80,128 KB |
testcase_28 | AC | 162 ms
80,340 KB |
testcase_29 | AC | 165 ms
80,212 KB |
testcase_30 | AC | 165 ms
80,332 KB |
testcase_31 | AC | 162 ms
80,192 KB |
testcase_32 | AC | 174 ms
80,084 KB |
testcase_33 | AC | 174 ms
80,652 KB |
testcase_34 | AC | 182 ms
82,944 KB |
testcase_35 | AC | 176 ms
80,912 KB |
testcase_36 | AC | 181 ms
82,776 KB |
testcase_37 | AC | 181 ms
81,712 KB |
testcase_38 | AC | 161 ms
80,060 KB |
testcase_39 | AC | 160 ms
80,328 KB |
testcase_40 | AC | 169 ms
80,224 KB |
testcase_41 | AC | 171 ms
80,204 KB |
testcase_42 | AC | 185 ms
82,816 KB |
testcase_43 | AC | 167 ms
80,236 KB |
testcase_44 | AC | 150 ms
79,876 KB |
testcase_45 | AC | 161 ms
80,432 KB |
testcase_46 | AC | 171 ms
80,456 KB |
testcase_47 | AC | 165 ms
80,220 KB |
testcase_48 | AC | 173 ms
81,384 KB |
testcase_49 | AC | 169 ms
80,124 KB |
testcase_50 | AC | 176 ms
81,540 KB |
testcase_51 | AC | 183 ms
82,624 KB |
testcase_52 | AC | 184 ms
82,688 KB |
testcase_53 | WA | - |
testcase_54 | WA | - |
testcase_55 | WA | - |
testcase_56 | AC | 216 ms
81,148 KB |
testcase_57 | WA | - |
testcase_58 | WA | - |
testcase_59 | WA | - |
testcase_60 | WA | - |
testcase_61 | WA | - |
testcase_62 | WA | - |
testcase_63 | AC | 170 ms
80,560 KB |
testcase_64 | WA | - |
testcase_65 | AC | 211 ms
80,604 KB |
testcase_66 | WA | - |
testcase_67 | WA | - |
testcase_68 | WA | - |
testcase_69 | WA | - |
testcase_70 | WA | - |
testcase_71 | WA | - |
testcase_72 | WA | - |
testcase_73 | WA | - |
testcase_74 | WA | - |
testcase_75 | WA | - |
testcase_76 | WA | - |
testcase_77 | WA | - |
testcase_78 | WA | - |
testcase_79 | WA | - |
testcase_80 | WA | - |
testcase_81 | WA | - |
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 v %= MOD2 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)