結果

問題 No.1237 EXP Multiple!
ユーザー 👑 NachiaNachia
提出日時 2020-09-27 20:27:11
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
RE  
実行時間 -
コード長 552 bytes
コンパイル時間 1,837 ms
コンパイル使用メモリ 167,360 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-09-13 02:14:23
合計ジャッジ時間 5,002 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 RE -
testcase_02 RE -
testcase_03 RE -
testcase_04 RE -
testcase_05 AC 33 ms
4,380 KB
testcase_06 AC 36 ms
4,380 KB
testcase_07 AC 34 ms
4,380 KB
testcase_08 AC 33 ms
4,380 KB
testcase_09 AC 32 ms
4,376 KB
testcase_10 AC 32 ms
4,380 KB
testcase_11 AC 35 ms
4,376 KB
testcase_12 AC 31 ms
4,376 KB
testcase_13 AC 33 ms
4,376 KB
testcase_14 AC 33 ms
4,376 KB
testcase_15 AC 33 ms
4,380 KB
testcase_16 AC 33 ms
4,376 KB
testcase_17 AC 34 ms
4,380 KB
testcase_18 AC 33 ms
4,380 KB
testcase_19 AC 32 ms
4,384 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
using LL=long long;
using ULL=unsigned long long;
#define rep(i,n) for(int i=0; i<(n); i++)

int N;
int A[200000];
ULL M = 1000000007;

int main() {
	cin >> N;
	rep(i, N) cin >> A[i];
	sort(A, A + N);
	if (A[0] == 0) { cout << -1 << endl; return 0; }
	if (A[N - 1] == 4) { cout << M << endl; return 0; }
	ULL T[4] = { 0,1,4,729 };
	ULL ans = 1;
	double L = 0;
	rep(i, N) { ans *= T[A[i]]; L += log(T[A[i]]); }
	if (L >= log(1.e10) || ans > M) cout << M << endl;
	else cout << (M % ans) << endl;
	return 0;
}
0