- 1#include 2 using namespace std;
- 3 typedef long long LL;
- 4 const int NICO = 200000 + 10;
- 5 const LL MOD = 1000000000 + 7;
- 6 int m,
- cnt[NICO];
- 7 8 LL mod_pow(LL p, LL k, LL mod) 9 {
- 10 LL res = 1;
- 11
- while (k > 0) 12 {
- 13
- if (k % 2 == 1) res = res * p % mod;
- 14 p = p * p % mod;
- 15 k /= 2;
- 16
- }
- 17
- return res % mod;
- 18
- }
- 19 20 int main() 21 {
- 22 cin >> m;
- 23
- for (int i = 1; i <= m; i++) 24 {
- 25 int k;
- cin >> k;
- 26 cnt[k]++;
- 27
- }
- 28 LL M = 1,
- ans = 1;
- 29
- for (int i = 1; i) 30 {
- 31 M = M * (cnt[i] + 1) % (2 * MOD - 2);
- 32
- }
- 33
- for (int i = 1; i) 34 {
- 35 LL tmp = M * cnt[i] % (2 * MOD - 2) / 2;
- 36 ans = ans * mod_pow(i, tmp, MOD) % MOD;
- 37
- }
- 38 cout << ans << endl;
- 39
- }
来源: