結果

問題 No.1237 EXP Multiple!
ユーザー GGanari
提出日時 2024-05-24 11:20:05
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 589 bytes
コンパイル時間 1,900 ms
コンパイル使用メモリ 193,588 KB
最終ジャッジ日時 2025-02-21 16:35:38
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 15 WA * 4
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#define INF 1000000001LL
#define MOD 1000000007LL
#define long long long
#define all(x) x.begin(),x.end()
using namespace std;

int main()
{
	ios_base::sync_with_stdio(0); 
    cin.tie(0);

	int n;
	cin >> n;
	vector<int> arr(n);
	long res = 1;
	for(int i = 0; i<n; i++)
	{
		cin >> arr[i];

		if(arr[i] == 0)
		{
			cout << -1 << endl;
			return 0;
		}

		if(arr[i] > 3)
			res = MOD+1;
		if(arr[i] == 3)
			res*=729;
		if(arr[i] == 2)
			res*=2;
		res = min(MOD+1,res);
	}
	if(MOD%res == 0)
		cout << -1 << endl;
	else
	cout << MOD%res << endl;
	
    return 0;
}
0