結果
問題 | No.1237 EXP Multiple! |
ユーザー |
![]() |
提出日時 | 2022-08-17 12:13:40 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 105 ms / 2,000 ms |
コード長 | 568 bytes |
コンパイル時間 | 2,521 ms |
コンパイル使用メモリ | 200,944 KB |
最終ジャッジ日時 | 2025-01-30 23:25:48 |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 19 |
ソースコード
#include <bits/stdc++.h> using namespace std; #define int long long signed main(){ int N; cin>>N; vector<int> S(N); for(int i=0;i<N;i++) cin>>S[i]; sort(S.rbegin(),S.rend()); if(S[0] >= 4){ cout<<1000000007<<endl; return 0; } reverse(S.begin(),S.end()); vector<int> A={0,1,4,729}; int ans = 1; for(int i=0;i<N;i++){ if(S[i] == 0){ cout<<-1<<endl; return 0; } ans *= A[S[i]]; if(ans > 1e9+7){ cout<<1000000007<<endl; return 0; } } cout<<1000000007%ans<<endl; }