結果

問題 No.1237 EXP Multiple!
ユーザー shell_mugshell_mug
提出日時 2020-09-25 22:19:22
言語 C++17(clang)
(17.0.6 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 2,080 bytes
コンパイル時間 4,760 ms
コンパイル使用メモリ 109,200 KB
実行使用メモリ 4,388 KB
最終ジャッジ日時 2023-09-10 15:33:54
合計ジャッジ時間 2,713 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ(β)

テストケース

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

ソースコード

diff #

#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <ctime>
#include <cassert>
#include <complex>
#include <string>
#include <cstring>
#include <chrono>
#include <random>
#include <queue>
#include <bitset>
#include <stack>
#include <functional>

// AtCoder
// #include <atcoder/all>
// using namespace atcoder;

#ifdef LOCAL
    #define eprintf(...) fprintf(stderr, __VA_ARGS__)
#else
    #define eprintf(...)
#endif

#define rep_(i, a_, b_, a, b, ...) for (int i = (a), i##_len = (b); i < i##_len; ++i)
#define rep(i, ...) rep_(i, __VA_ARGS__, __VA_ARGS__, 0, __VA_ARGS__)
#define reprev_(i, a_, b_, a, b, ...) for (int i = (b-1), i##_min = (a); i >= i##_min; --i)
#define reprev(i, ...) reprev_(i, __VA_ARGS__, __VA_ARGS__, 0, __VA_ARGS__)
#define all(x) (x).begin(), (x).end()
template <class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return 1; } return 0; }
template <class T> bool chmin(T &a, const T &b) { if (b < a) { a = b; return 1; } return 0; }
#define fls(x) (64 - __builtin_clzll(x))
#define pcnt(x) __builtin_popcountll(x)
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair <int,int> P;
typedef long double ld;

constexpr int MOD = 1000000007;

int main (void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);

    ll n; cin >> n;
    ll x = 1;
    rep (i, n) {
        ll a; cin >> a;
        if (a >= 4) {
            cout << MOD << "\n";
            return 0;
        } else if (a == 0) {
            cout << -1 << "\n";
        } else if (a == 2) {
            x *= 4;
        } else if (a == 3) {
            x *= 729;
        }
        if (x > MOD) {
            cout << MOD << "\n";
            return 0;
        }
    }
    cout << MOD % x << "\n";

    /***************************************************/
    /* Use "submit code (with ACL v1)" when using ACL! */
    /***************************************************/
    return 0;
}
0