結果
| 問題 | 
                            No.1237 EXP Multiple!
                             | 
                    
| コンテスト | |
| ユーザー | 
                             piddy
                         | 
                    
| 提出日時 | 2020-09-25 23:20:08 | 
| 言語 | C++17  (gcc 13.3.0 + boost 1.87.0)  | 
                    
| 結果 | 
                             
                                RE
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 711 bytes | 
| コンパイル時間 | 1,700 ms | 
| コンパイル使用メモリ | 200,820 KB | 
| 最終ジャッジ日時 | 2025-01-14 21:37:21 | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge5 / judge5 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 1 | 
| other | AC * 13 RE * 6 | 
ソースコード
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
void Yes() {cout << "Yes\n";}
void No() {cout << "No\n";}
void YES() {cout << "YES\n";}
void NO() {cout << "NO\n";}
int main() {
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	int P = 1000000007;
	int n;
	cin >> n;
	vector<int> a(n);
	for (int i = 0; i < n; i++) cin >> a[i];
	sort(a.rbegin(), a.rend());
	long long pi = 1;
	for (int i = 0; i < n; i++) {
		long long subpi = 1;
		for (int j = 1; j <= a[i]; j++) {
			subpi *= j;
			if (subpi > P) {
				cout << P << endl;
				return 0;
			}
		}
		while (subpi--) {
			pi *= a[i];
			if (subpi > P) {
				cout << P << endl;
				return 0;
			}
		}
	}
	cout << P % pi << endl;
	return 0;
}
            
            
            
        
            
piddy