結果

問題 No.1682 Unfair Game
ユーザー ぷら
提出日時 2021-12-07 20:21:53
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 669 bytes
コンパイル時間 1,904 ms
コンパイル使用メモリ 194,616 KB
最終ジャッジ日時 2025-01-26 06:35:31
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 20
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

constexpr int mod = 1000000007;

long long modpow(long long a,long long b) {
    long long ans = 1;
    while(b) {
        if(b & 1) {
            (ans *= a) %= mod;
        }
        (a *= a) %= mod;
        b /= 2;
    }
    return ans;
}

int main() {
    int n;
    cin >> n;
    vector<int>p(n);
    int cnt = 0,cnt2 = 0;
    for(int i = 0; i < n; i++) {
        cin >> p[i];
        if(p[i] > 50) {
            cnt++;
        }
        if(p[i] < 50) {
            cnt2++;
        }
    }
    if(cnt == 0) {
        cout << 0 << endl;
        return 0;
    }
    cout << modpow(2,cnt-1)*modpow(2,cnt2)%mod << endl;
}
0