結果

問題 No.1237 EXP Multiple!
ユーザー shinchanshinchan
提出日時 2021-01-12 20:01:40
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 23 ms / 2,000 ms
コード長 1,014 bytes
コンパイル時間 2,111 ms
コンパイル使用メモリ 203,760 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-05-01 07:20:39
合計ジャッジ時間 3,495 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,812 KB
testcase_01 AC 16 ms
6,944 KB
testcase_02 AC 21 ms
6,940 KB
testcase_03 AC 22 ms
6,940 KB
testcase_04 AC 23 ms
6,944 KB
testcase_05 AC 12 ms
6,940 KB
testcase_06 AC 12 ms
6,944 KB
testcase_07 AC 12 ms
6,944 KB
testcase_08 AC 12 ms
6,940 KB
testcase_09 AC 12 ms
6,940 KB
testcase_10 AC 13 ms
6,940 KB
testcase_11 AC 12 ms
6,940 KB
testcase_12 AC 12 ms
6,940 KB
testcase_13 AC 13 ms
6,940 KB
testcase_14 AC 12 ms
6,940 KB
testcase_15 AC 13 ms
6,944 KB
testcase_16 AC 12 ms
6,940 KB
testcase_17 AC 12 ms
6,940 KB
testcase_18 AC 12 ms
6,940 KB
testcase_19 AC 12 ms
6,944 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#define be(v) (v).begin(),(v).end()
#define pb(q) push_back(q)
#define rep(i, n) for(int i=0;i<n;i++)
#define all(i, v) for(auto& i : v)
typedef long long ll;
using namespace std;
const ll mod=1000000007, INF=(1LL<<60);
#define doublecout(a) cout<<fixed<<setprecision(10)<<a<<endl;
#define asdf() cout << "debugdayo!!" << endl;

int main() {
    cin.tie(0);
    cout.tie(0);
    ios::sync_with_stdio(false);
    ll n;
    cin >> n;
    bool ok = false, ok0 = 0;
    vector<ll> a(n);
    rep(i, n){
        cin >> a[i];
        if(a[i] == 0) ok0 = true;
    }
    if(ok0) {
        cout << -1 << endl;
        return 0;
    }
    ll ans = 1;
    rep(i, n){
        if(a[i] == 2){
            ans *= 4;
        }else if(a[i] == 3){
            ans *= 9*9*9;
        }else if(a[i] >= 4){
            ok = true;
        }
        if(ans > mod) ok = true;
        if(ok){
            cout << mod << endl;
            return 0;
        }
    }
    cout << mod % ans << endl;


    return 0;
}


0