結果
| 問題 | 
                            No.1237 EXP Multiple!
                             | 
                    
| コンテスト | |
| ユーザー | 
                             | 
                    
| 提出日時 | 2021-12-20 09:36:58 | 
| 言語 | C++17  (gcc 13.3.0 + boost 1.87.0)  | 
                    
| 結果 | 
                             
                                AC
                                 
                             
                            
                         | 
                    
| 実行時間 | 110 ms / 2,000 ms | 
| コード長 | 1,026 bytes | 
| コンパイル時間 | 2,001 ms | 
| コンパイル使用メモリ | 199,692 KB | 
| 最終ジャッジ日時 | 2025-01-27 04:12:26 | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge3 / judge2 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 1 | 
| other | AC * 19 | 
ソースコード
#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;
    }
}