結果

問題 No.1237 EXP Multiple!
ユーザー shiomusubi496shiomusubi496
提出日時 2020-09-25 21:47:49
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 83 ms / 2,000 ms
コード長 586 bytes
コンパイル時間 1,811 ms
コンパイル使用メモリ 165,148 KB
実行使用メモリ 4,908 KB
最終ジャッジ日時 2023-09-10 17:24:06
合計ジャッジ時間 3,368 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 55 ms
4,380 KB
testcase_02 AC 74 ms
4,624 KB
testcase_03 AC 75 ms
4,900 KB
testcase_04 AC 83 ms
4,708 KB
testcase_05 AC 3 ms
4,908 KB
testcase_06 AC 30 ms
4,584 KB
testcase_07 AC 3 ms
4,696 KB
testcase_08 AC 31 ms
4,688 KB
testcase_09 AC 3 ms
4,764 KB
testcase_10 AC 3 ms
4,772 KB
testcase_11 AC 30 ms
4,624 KB
testcase_12 AC 31 ms
4,624 KB
testcase_13 AC 30 ms
4,760 KB
testcase_14 AC 30 ms
4,576 KB
testcase_15 AC 31 ms
4,580 KB
testcase_16 AC 30 ms
4,704 KB
testcase_17 AC 30 ms
4,632 KB
testcase_18 AC 31 ms
4,640 KB
testcase_19 AC 30 ms
4,764 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
#define int long long
using namespace std;
const int mod=1000000007;
int dat[]={1,1,2,6};
signed main(){
    int N,ans=1;
    cin>>N;
    vector<int> A(N);
    for(int &i:A){
        cin>>i;
        if(i==0){
            puts("-1");
            return 0;
        }
    }
    for(int a:A){
        if(a>3){
            cout<<mod<<endl;
            return 0;
        }
        for(int i=0;i<dat[a];i++){
            ans*=a;
            if(ans>mod){
                cout<<mod<<endl;
                return 0;
            }
        }
    }
    cout<<mod%ans<<endl;
}
0