結果

問題 No.1237 EXP Multiple!
ユーザー karinohitokarinohito
提出日時 2021-08-08 14:46:08
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 87 ms / 2,000 ms
コード長 715 bytes
コンパイル時間 1,686 ms
コンパイル使用メモリ 171,184 KB
実行使用メモリ 4,952 KB
最終ジャッジ日時 2023-10-19 14:57:33
合計ジャッジ時間 3,334 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,348 KB
testcase_01 AC 58 ms
4,424 KB
testcase_02 AC 78 ms
4,952 KB
testcase_03 AC 80 ms
4,952 KB
testcase_04 AC 87 ms
4,952 KB
testcase_05 AC 3 ms
4,952 KB
testcase_06 AC 32 ms
4,952 KB
testcase_07 AC 3 ms
4,952 KB
testcase_08 AC 32 ms
4,952 KB
testcase_09 AC 3 ms
4,952 KB
testcase_10 AC 3 ms
4,952 KB
testcase_11 AC 32 ms
4,952 KB
testcase_12 AC 33 ms
4,952 KB
testcase_13 AC 32 ms
4,952 KB
testcase_14 AC 32 ms
4,952 KB
testcase_15 AC 32 ms
4,952 KB
testcase_16 AC 32 ms
4,952 KB
testcase_17 AC 32 ms
4,952 KB
testcase_18 AC 33 ms
4,952 KB
testcase_19 AC 32 ms
4,952 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

//#include <atcoder/all>
#include <bits/stdc++.h>
#include <cmath>
using namespace std;
//using namespace atcoder;
using ll = long long;
#define all(A) A.begin(),A.end()
using vll = vector<ll>;
#define rep(i, n) for (long long i = 0; i < (long long)(n); i++)
using Graph = vector<vector<ll>>;
Graph G;
vll E;
vector<bool> seen;

int main() {
	ll N;
	cin>>N;
	vll A(N);
	rep(i,N){
		cin>>A[i];
		if(A[i]==0){
			cout<<-1<<endl;
			return 0;
		}
		
	}
	rep(i,N){
		if(A[i]>3){
			cout<<ll(1e9+7)<<endl;
			return 0;
		}
	}
	ll an=1;
	rep(i,N){
		if(A[i]==1){
			
		}

		else if(A[i]==2){
			an*=4;
		}
		else{
			an*=729;
		}
		if(an>1e9+7){
			cout<<ll(1e9+7)<<endl;
			return 0;
		}
	}
	cout<<ll(1e9+7)%an<<endl;
}
0