結果
問題 | No.1237 EXP Multiple! |
ユーザー |
![]() |
提出日時 | 2020-09-26 01:17:37 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 85 ms / 2,000 ms |
コード長 | 701 bytes |
コンパイル時間 | 1,663 ms |
コンパイル使用メモリ | 194,256 KB |
最終ジャッジ日時 | 2025-01-14 21:50:47 |
ジャッジサーバーID (参考情報) |
judge1 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 19 |
ソースコード
#define rep(i, n) for (int i = 0; i < (int)(n); i++) #define ALL(v) v.begin(), v.end() typedef long long ll; #include <bits/stdc++.h> using namespace std; const int MOD=1e9+7; int main(){ int n; cin>>n; vector<int> A(5); rep(i,n){ int x; cin>>x; if(x>3) A[4]++; else A[x]++; } ll ans=1; if(A[0]>0){ cout<<-1<<endl; return 0; } else if(A[4]>0){ cout<<MOD<<endl; return 0; } else{ rep(i,A[3]){ ans*=729; if(ans>MOD){ cout<<MOD<<endl; return 0; } } rep(i,A[2]){ ans*=4; if(ans>MOD){ cout<<MOD<<endl; return 0; } } } cout<<MOD%ans<<endl; return 0; }