結果

問題 No.1237 EXP Multiple!
ユーザー yuuiyuui
提出日時 2020-09-25 23:12:40
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
RE  
実行時間 -
コード長 771 bytes
コンパイル時間 2,342 ms
コンパイル使用メモリ 203,392 KB
実行使用メモリ 4,704 KB
最終ジャッジ日時 2023-09-10 16:12:39
合計ジャッジ時間 4,400 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 66 ms
4,376 KB
testcase_02 AC 90 ms
4,592 KB
testcase_03 AC 92 ms
4,652 KB
testcase_04 AC 86 ms
4,648 KB
testcase_05 AC 33 ms
4,688 KB
testcase_06 AC 35 ms
4,600 KB
testcase_07 AC 34 ms
4,624 KB
testcase_08 AC 33 ms
4,660 KB
testcase_09 AC 32 ms
4,652 KB
testcase_10 AC 32 ms
4,588 KB
testcase_11 RE -
testcase_12 AC 34 ms
4,660 KB
testcase_13 AC 33 ms
4,592 KB
testcase_14 AC 33 ms
4,588 KB
testcase_15 AC 34 ms
4,604 KB
testcase_16 AC 33 ms
4,588 KB
testcase_17 AC 33 ms
4,704 KB
testcase_18 AC 32 ms
4,588 KB
testcase_19 AC 33 ms
4,688 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

int main() {
    ll N;
    cin >> N;
    vector<ll> a(N);
    rep(i, N) {
        cin >> a[i];
    }
    sort(a.begin(), a.end());
    if (a[0] == 0) {
        cout << -1 << endl;
        return 0;
    }
    ll ans = 1;
    rep(i, N) {
        if (a[i] >= 4) {
            cout << mod << endl;
            return 0;
        }
        ll div = 1;
        rep(j, a[i]) {
            div *= (j + 1);
        }
        // cerr << "div" << div << endl;
        rep(j, div) {
            ans *= a[i];
            if (ans > (mod)) {
                break;
            }
        }
    }
    cout << mod % ans << endl;
    return 0;
}
0