結果
| 問題 |
No.1237 EXP Multiple!
|
| コンテスト | |
| ユーザー |
Example0911
|
| 提出日時 | 2020-09-26 14:30:51 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 87 ms / 2,000 ms |
| コード長 | 776 bytes |
| コンパイル時間 | 1,502 ms |
| コンパイル使用メモリ | 168,372 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-06-29 01:56:42 |
| 合計ジャッジ時間 | 3,266 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 19 |
ソースコード
#include "bits/stdc++.h"
//#include <atcoder/all>
using namespace std;
//using namespace atcoder;
//#define int long long
#define ll long long
ll INF = (1LL << 60);
int mod = 1000000007;
using P = pair<int, int>;
signed main() {
int N; cin >> N;
vector<ll>A(N); for (int i = 0; i < N; i++)cin >> A[i];
for (int i = 0; i < N; i++) {
if (A[i] == 0) {
cout << -1 << endl; return 0;
}
}
ll now = 1;
for (int i = 0; i < N; i++) {
if (now >= mod) {
cout << mod << endl; return 0;
}
if (A[i] == 1) {
}
else if (A[i] == 2) {
now *= 4;
}
else if (A[i] == 3) {
now *= 3 * 3 * 3 * 3 * 3 * 3;
}
else {
cout << mod << endl; return 0;
}
}
if (now >= mod) {
cout << mod << endl; return 0;
}
cout << mod % now << endl;
return 0;
}
Example0911