結果

問題 No.1237 EXP Multiple!
ユーザー kyoprounokyoprouno
提出日時 2020-09-25 23:09:52
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,129 bytes
コンパイル時間 2,044 ms
コンパイル使用メモリ 174,504 KB
実行使用メモリ 4,904 KB
最終ジャッジ日時 2023-09-10 16:11:59
合計ジャッジ時間 3,905 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 55 ms
4,380 KB
testcase_02 AC 74 ms
4,740 KB
testcase_03 AC 75 ms
4,704 KB
testcase_04 AC 83 ms
4,600 KB
testcase_05 WA -
testcase_06 AC 30 ms
4,772 KB
testcase_07 WA -
testcase_08 AC 30 ms
4,596 KB
testcase_09 WA -
testcase_10 WA -
testcase_11 AC 30 ms
4,572 KB
testcase_12 WA -
testcase_13 AC 30 ms
4,668 KB
testcase_14 WA -
testcase_15 WA -
testcase_16 AC 30 ms
4,728 KB
testcase_17 AC 30 ms
4,672 KB
testcase_18 AC 30 ms
4,620 KB
testcase_19 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#pragma GCC optimize("O3")
#include <bits/stdc++.h>
#define ll long long
#define rep(i,n) for(ll i=0;i<(n);i++)
#define pll pair<ll,ll>
#define pii pair<int,int>
#define pq priority_queue
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define endl '\n'
#define ios ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
#define lb(c,x) distance(c.begin(),lower_bound(all(c),x))
#define ub(c,x) distance(c.begin(),upper_bound(all(c),x))

using namespace std;

const ll mod=1e9+7;

int main(){
    ll n;
    cin >> n;
    vector<ll> a(n);
    bool zero=false;
    bool over=false;
    rep(i,n){
        cin >> a[i];
        if(a[i]==0) zero=true;
        if(a[i]>=14) over=true;
    }
    if(zero){
        cout << -1 << endl;
    }
    ll val=1;
    rep(i,n){
        if(over) break;
        for(ll j=1;j<=a[i];j++){
            rep(k,j){
                val*=a[i];
                if(val>mod) break;
            }
            if(val>mod) break;
        }
        if(val>mod) break;
    }
    if(val>mod) over=true;
    if(over) cout << mod << endl;
    else cout << mod%val << endl;
    return 0;
}
0