結果

問題 No.1237 EXP Multiple!
ユーザー milanis48663220milanis48663220
提出日時 2020-09-25 21:47:39
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,135 bytes
コンパイル時間 689 ms
コンパイル使用メモリ 82,216 KB
実行使用メモリ 5,212 KB
最終ジャッジ日時 2023-09-10 15:10:25
合計ジャッジ時間 2,060 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 19 ms
4,588 KB
testcase_02 AC 25 ms
4,996 KB
testcase_03 AC 25 ms
4,912 KB
testcase_04 AC 27 ms
5,084 KB
testcase_05 WA -
testcase_06 AC 14 ms
4,932 KB
testcase_07 WA -
testcase_08 AC 14 ms
4,920 KB
testcase_09 WA -
testcase_10 WA -
testcase_11 AC 14 ms
5,040 KB
testcase_12 AC 14 ms
4,944 KB
testcase_13 AC 14 ms
5,004 KB
testcase_14 AC 14 ms
5,040 KB
testcase_15 AC 14 ms
5,040 KB
testcase_16 AC 13 ms
4,964 KB
testcase_17 AC 14 ms
4,944 KB
testcase_18 AC 14 ms
5,092 KB
testcase_19 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <algorithm>
#include <iomanip>
#include <vector>
#include <queue>
#include <set>
#include <map>
#define N_MAX 200002

using namespace std;
typedef long long ll;


ll fac[N_MAX];

void init(ll MOD){
    fac[0]=1;fac[1]=1;
    for(int i=2;i<N_MAX;i++){
        fac[i]=fac[i-1]*(ll)i;
        fac[i] %= MOD;
    }
}

template <typename T>
T pow(T a, ll n, ll MOD) {
	T ans = 1;
	T tmp = a;
	for (int i = 0; i <= 60; i++) {
		ll m = (ll)1 << i;
		if (m & n) {
		ans *= tmp;
		ans %= MOD;
		}
		tmp *= tmp;
		tmp %= MOD;
	}
	return ans;
}

const ll p = 1000000007;

int N;
ll A[200000];

ll c[4] = {1, 1, 4, 729};

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << setprecision(10) << fixed;
    cin >> N;
    bool too_big = false;
    for(int i = 0; i < N; i++) {
        cin >> A[i];
        if(A[i] >= 4) too_big = true;
    }
    if(too_big){
        cout << p << endl;
        return 0;
    }
    ll ans = 1;
    for(int i = 0; i < N; i++){
        ans *= c[A[i]];
        if(ans > p){
            cout << p << endl;
            return 0;
        }
    }
    cout << p%ans << endl;
}
0