結果
| 問題 |
No.1237 EXP Multiple!
|
| コンテスト | |
| ユーザー |
iqueue02
|
| 提出日時 | 2020-09-25 23:33:29 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
RE
|
| 実行時間 | - |
| コード長 | 670 bytes |
| コンパイル時間 | 3,008 ms |
| コンパイル使用メモリ | 197,500 KB |
| 最終ジャッジ日時 | 2025-01-14 21:41:44 |
|
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 18 RE * 1 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < (n);i++)
#define sz(x) int(x.size())
typedef long long ll;
typedef long double ld;
typedef pair<int,int> P;
constexpr ll mod = 1e9+7;
int main() {
int n;
cin >> n;
vector<ll> a(n);
rep(i,n) cin >> a[i];
sort(a.begin(), a.end());
if (a.front() == 0LL) {
cout << -1 << endl;
return 0;
}
if (a.back() >= 4LL) {
cout << mod << endl;
return 0;
}
ll res = 1;
for (int i = 0; i < n; i++) {
int fact = 1;
for (int j = 0; j < a[i]; j++) fact *= (j + 1);
for (int j = 0; j < fact; j++) res *= a[i];
}
cout << mod % res << endl;
return 0;
}
iqueue02