結果

問題 No.1237 EXP Multiple!
ユーザー hiikunZhiikunZ
提出日時 2021-12-20 09:36:58
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 91 ms / 2,000 ms
コード長 1,026 bytes
コンパイル時間 3,120 ms
コンパイル使用メモリ 203,548 KB
実行使用メモリ 4,892 KB
最終ジャッジ日時 2023-10-13 19:27:08
合計ジャッジ時間 7,102 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,348 KB
testcase_01 AC 66 ms
4,348 KB
testcase_02 AC 89 ms
4,540 KB
testcase_03 AC 91 ms
4,740 KB
testcase_04 AC 86 ms
4,692 KB
testcase_05 AC 33 ms
4,688 KB
testcase_06 AC 33 ms
4,892 KB
testcase_07 AC 35 ms
4,732 KB
testcase_08 AC 38 ms
4,672 KB
testcase_09 AC 33 ms
4,628 KB
testcase_10 AC 33 ms
4,760 KB
testcase_11 AC 33 ms
4,576 KB
testcase_12 AC 38 ms
4,660 KB
testcase_13 AC 37 ms
4,540 KB
testcase_14 AC 38 ms
4,668 KB
testcase_15 AC 37 ms
4,672 KB
testcase_16 AC 38 ms
4,660 KB
testcase_17 AC 38 ms
4,580 KB
testcase_18 AC 37 ms
4,740 KB
testcase_19 AC 33 ms
4,740 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
//#include<atcoder/all>
//using namespace atcoder;
using ll = long long int;
using ull = unsigned long long int;
using ld = long double;
constexpr ll MAX = 2000000000000000000;
constexpr ld PI = 3.14159265358979;
constexpr ll MOD = 0;//2024948111;
ld dotorad(ld K){return PI * K / 180.0;}
ld radtodo(ld K){return K * 180.0 / PI;}
mt19937 mt;
void randinit(){srand((unsigned)time(NULL));mt = mt19937(rand());}
int main(){
    ll N;
    cin >> N;
    vector<ll> A(N);
    for(ll i = 0;i < N;i++) cin >> A[i];
    sort(A.begin(),A.end());
    if(A[0] == 0){
        cout << -1 << endl;
    }
    else{
        ll a = 1;
        for(ll i = 0;i < N;i++){
            if(A[i] > 3){
                cout << 1000000007 << endl;
                return 0;
            }
            a *= vector<ll>{-1,1,4,729}[A[i]];
            if(a > 1000000007){
                cout << 1000000007 << endl;
                return 0;
            }
        }
        cout << 1000000007 % a << endl;
    }
}
0