結果

問題 No.1237 EXP Multiple!
ユーザー testtest
提出日時 2020-09-25 23:45:37
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 673 bytes
コンパイル時間 2,230 ms
コンパイル使用メモリ 200,388 KB
実行使用メモリ 4,776 KB
最終ジャッジ日時 2023-09-10 17:13:33
合計ジャッジ時間 3,232 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 19 ms
4,376 KB
testcase_02 AC 25 ms
4,636 KB
testcase_03 AC 25 ms
4,536 KB
testcase_04 AC 27 ms
4,628 KB
testcase_05 WA -
testcase_06 AC 27 ms
4,572 KB
testcase_07 WA -
testcase_08 AC 15 ms
4,552 KB
testcase_09 WA -
testcase_10 WA -
testcase_11 AC 16 ms
4,552 KB
testcase_12 AC 14 ms
4,680 KB
testcase_13 AC 17 ms
4,776 KB
testcase_14 AC 16 ms
4,548 KB
testcase_15 AC 16 ms
4,604 KB
testcase_16 AC 16 ms
4,552 KB
testcase_17 AC 16 ms
4,620 KB
testcase_18 AC 15 ms
4,576 KB
testcase_19 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#define rep(i, ss, ee) for (int i = ss; i < ee; ++i)
using namespace std;
using ll = long long;
const ll MOD = 1e9 + 7;

inline ll f(ll k) {
  ll sum = 1;
  for (ll ii = 1; ii <= k; ++ii) { sum *= ii; }
  return sum;
}

void solve() {
  int N;
  cin >> N;
  vector<ll> a(N);

  ll mx = 0;
  rep(i, 0, N) {
    cin >> a[i];
    if (a[i] == 0) {
      cout << 0 << endl;
      return;
    }
    mx = max(mx, a[i]);
  }
  if (mx >= 4) {
    cout << MOD << endl;
    return;
  }

  ll ans = 1;
  for (ll x : a) { ans *= pow(x, f(x)); }

  ans = MOD % ans;
  cout << ans << endl;
}

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  solve();
}
0