結果

問題 No.1237 EXP Multiple!
ユーザー rogi52rogi52
提出日時 2022-10-01 07:51:07
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 741 bytes
コンパイル時間 1,965 ms
コンパイル使用メモリ 200,592 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-08-25 00:47:07
合計ジャッジ時間 6,049 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 17 ms
4,380 KB
testcase_02 AC 22 ms
4,376 KB
testcase_03 AC 23 ms
4,384 KB
testcase_04 AC 25 ms
4,380 KB
testcase_05 WA -
testcase_06 AC 12 ms
4,380 KB
testcase_07 WA -
testcase_08 AC 13 ms
4,384 KB
testcase_09 WA -
testcase_10 WA -
testcase_11 AC 12 ms
4,380 KB
testcase_12 AC 12 ms
4,376 KB
testcase_13 AC 13 ms
4,376 KB
testcase_14 AC 13 ms
4,380 KB
testcase_15 AC 13 ms
4,380 KB
testcase_16 AC 13 ms
4,380 KB
testcase_17 AC 13 ms
4,376 KB
testcase_18 AC 13 ms
4,380 KB
testcase_19 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (n); i++)
using namespace std;
typedef long long ll;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(0);
    
    int N; cin >> N;
    ll target = 1e9+7;
    vector<int> A(N);
    rep(i,N) cin >> A[i];
    if(*max_element(A.begin(), A.end()) >= 4) {
        cout << target << endl;
    } else {
        ll prod = 1;
        rep(i,N) {
            if(A[i] == 2) {
                prod *= 4;
                if(prod > target) { cout << target << endl; return 0; }
            }
            if(A[i] == 3) {
                prod *= 729;
                if(prod > target){ cout << target << endl; return 0; }
            }
        }
        cout << target % prod << endl;
    }
}
0