/ SeriousOJ /

Record Detail

Wrong Answer


  
# Status Time Cost Memory Cost
#1 Wrong Answer 1ms 532.0 KiB
#2 Wrong Answer 1ms 532.0 KiB

Code

#include <iostream>
#include <vector>
using namespace std;

const int MOD = 1e9 + 7;
long long mod_pow(long long base, long long exp, long long mod) {
    long long result = 1;
    while (exp > 0) {
        if (exp % 2 == 1) result = (result * base) % mod;
        base = (base * base) % mod;
        exp /= 2;
    }
    return result;
}

void solve() {
    int N;
    long long K;
    cin >> N >> K;
    
    vector<int> A(N);
    long long total_sum = 0;
    for (int i = 0; i < N; ++i) {
        cin >> A[i];
        total_sum += A[i];
    }

    if (total_sum < K) {
        cout << 0 << endl;
        return;
    }

    int cnt1 = 0;
    for (int i = 0; i < N; ++i) {
        if (A[i] == 1) cnt1++;
    }
    long long total_subsets = (mod_pow(2, N, MOD) - 1 + MOD) % MOD;
    cout << total_subsets << endl;
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    
    int T;
    cin >> T;
    while (T--) {
        solve();
    }
    return 0;
}

Information

Submit By
Type
Submission
Problem
P1093 Number of Ways (Easy version)
Language
C++17 (G++ 13.2.0)
Submit At
2024-11-05 11:00:29
Judged At
2024-11-11 02:33:17
Judged By
Score
0
Total Time
1ms
Peak Memory
532.0 KiB