結果

問題 No.1237 EXP Multiple!
ユーザー kyo1
提出日時 2020-10-11 16:45:10
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 672 bytes
コンパイル時間 1,962 ms
コンパイル使用メモリ 193,904 KB
最終ジャッジ日時 2025-01-15 06:39:44
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 17 WA * 2
権限があれば一括ダウンロードができます

ソースコード

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';
      return 0;
    }
  }
  int64_t res = 1;
  for (int i = 0; i < N; i++) {
    int64_t a = A[i];
    if (a > 3) {
      cout << MOD << '\n';
      return 0;
    }
    for (int j = 0; j < a; j++) {
      for (int k = 0; k < j + 1; k++) {
        res *= a;
        if (res > MOD) {
          cout << MOD << '\n';
          return 0;
        }
      }
    }
  }
  cout << MOD % res << '\n';
  return 0;
}
0