結果

問題 No.1237 EXP Multiple!
ユーザー startcppstartcpp
提出日時 2022-01-22 15:32:24
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 575 bytes
コンパイル時間 1,089 ms
コンパイル使用メモリ 63,704 KB
実行使用メモリ 5,100 KB
最終ジャッジ日時 2023-08-18 08:57:36
合計ジャッジ時間 2,119 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 1 ms
4,380 KB
testcase_03 AC 1 ms
4,376 KB
testcase_04 AC 2 ms
4,380 KB
testcase_05 AC 1 ms
4,376 KB
testcase_06 AC 1 ms
4,376 KB
testcase_07 AC 1 ms
4,376 KB
testcase_08 AC 29 ms
4,916 KB
testcase_09 AC 2 ms
4,380 KB
testcase_10 AC 2 ms
4,380 KB
testcase_11 AC 2 ms
4,384 KB
testcase_12 AC 25 ms
4,648 KB
testcase_13 AC 30 ms
4,964 KB
testcase_14 AC 30 ms
5,020 KB
testcase_15 AC 30 ms
5,100 KB
testcase_16 AC 30 ms
4,920 KB
testcase_17 AC 30 ms
4,924 KB
testcase_18 AC 30 ms
4,860 KB
testcase_19 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

//答え「で」10^9 + 7を割った余りなので、答え > 10^9 + 7 なら速攻で0を返してOK。
#include <iostream>
#define int long long
using namespace std;

int mod = 1000000007;
int n;
int a[200000];

signed main() {
	int i;
	
	int ans = 1;
	
	cin >> n;
	for (i = 0; i < n; i++) {
		cin >> a[i];
		if (a[i] >= 4) { cout << mod << endl; return 0; }
		if (a[i] == 0) { cout << -1 << endl; return 0; }
		if (a[i] == 2) { ans *= 4; }
		if (a[i] == 3) { ans *= 729; }
		if (ans > mod) { cout << mod << endl; return 0; }
	}
	
	cout << mod % ans << endl;
	return 0;
}
0