結果
問題 |
No.1237 EXP Multiple!
|
ユーザー |
![]() |
提出日時 | 2020-09-25 21:46:57 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
RE
|
実行時間 | - |
コード長 | 1,135 bytes |
コンパイル時間 | 666 ms |
コンパイル使用メモリ | 82,380 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-06-28 06:20:28 |
合計ジャッジ時間 | 2,408 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 1 WA * 14 RE * 4 |
ソースコード
#include <iostream> #include <algorithm> #include <iomanip> #include <vector> #include <queue> #include <set> #include <map> #define N_MAX 200002 using namespace std; typedef long long ll; ll fac[N_MAX]; void init(ll MOD){ fac[0]=1;fac[1]=1; for(int i=2;i<N_MAX;i++){ fac[i]=fac[i-1]*(ll)i; fac[i] %= MOD; } } template <typename T> T pow(T a, ll n, ll MOD) { T ans = 1; T tmp = a; for (int i = 0; i <= 60; i++) { ll m = (ll)1 << i; if (m & n) { ans *= tmp; ans %= MOD; } tmp *= tmp; tmp %= MOD; } return ans; } const ll p = 1000000007; int N; ll A[100000]; ll c[4] = {1, 1, 4, 729}; int main(){ ios::sync_with_stdio(false); cin.tie(0); cout << setprecision(10) << fixed; cin >> N; bool too_big = false; for(int i = 0; i < N; i++) { cin >> A[i]; if(A[i] >= 4) too_big = true; } if(too_big){ cout << p << endl; return 0; } ll ans = 1; for(int i = 0; i < N; i++){ ans *= c[A[i]]; if(ans > p){ cout << p << endl; return 0; } } cout << p%ans << endl; }