結果

問題 No.1237 EXP Multiple!
ユーザー kyo1kyo1
提出日時 2020-10-11 16:39:15
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
RE  
実行時間 -
コード長 675 bytes
コンパイル時間 1,875 ms
コンパイル使用メモリ 200,120 KB
実行使用メモリ 5,064 KB
最終ジャッジ日時 2023-09-27 23:03:55
合計ジャッジ時間 3,565 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 16 ms
4,380 KB
testcase_02 AC 22 ms
4,696 KB
testcase_03 AC 20 ms
4,608 KB
testcase_04 AC 23 ms
4,588 KB
testcase_05 RE -
testcase_06 AC 11 ms
4,548 KB
testcase_07 RE -
testcase_08 AC 13 ms
4,636 KB
testcase_09 RE -
testcase_10 RE -
testcase_11 AC 13 ms
4,548 KB
testcase_12 AC 12 ms
4,632 KB
testcase_13 AC 12 ms
4,596 KB
testcase_14 AC 12 ms
4,736 KB
testcase_15 AC 11 ms
4,536 KB
testcase_16 AC 12 ms
4,548 KB
testcase_17 AC 12 ms
4,588 KB
testcase_18 AC 12 ms
4,624 KB
testcase_19 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  const int MOD = 1000000007;
  int N;
  cin >> N;
  vector<int64_t> A(N);
  for (auto&& e : A) {
    cin >> e;
    if (e == 0) {
      cout << -1 << '\n';
    }
  }
  int64_t res = 1;
  for (int i = 0; i < N; i++) {
    int64_t a = A[i];
    if (a > 3) {
      cout << MOD << '\n';
      return 0;
    }
    int64_t j = 1;
    for (int k = 0; k < a; k++) {
      j *= k + 1;
    }
    for (int k = 0; k < j; k++) {
      res *= a;
      if (res > MOD) {
        cout << MOD << '\n';
        return 0;
      }
    }
  }
  cout << MOD % res << '\n';
  return 0;
}
0