結果

問題 No.1237 EXP Multiple!
ユーザー kyo1kyo1
提出日時 2020-10-11 16:45:10
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 672 bytes
コンパイル時間 2,101 ms
コンパイル使用メモリ 199,256 KB
実行使用メモリ 4,856 KB
最終ジャッジ日時 2023-09-27 23:04:09
合計ジャッジ時間 2,881 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 15 ms
4,380 KB
testcase_02 AC 20 ms
4,604 KB
testcase_03 AC 20 ms
4,856 KB
testcase_04 AC 22 ms
4,604 KB
testcase_05 AC 2 ms
4,676 KB
testcase_06 AC 11 ms
4,600 KB
testcase_07 AC 2 ms
4,632 KB
testcase_08 AC 12 ms
4,680 KB
testcase_09 AC 2 ms
4,684 KB
testcase_10 AC 2 ms
4,544 KB
testcase_11 AC 12 ms
4,688 KB
testcase_12 AC 12 ms
4,668 KB
testcase_13 AC 13 ms
4,620 KB
testcase_14 WA -
testcase_15 WA -
testcase_16 AC 11 ms
4,788 KB
testcase_17 AC 12 ms
4,680 KB
testcase_18 AC 11 ms
4,688 KB
testcase_19 AC 12 ms
4,596 KB
権限があれば一括ダウンロードができます

ソースコード

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