115092024-10-15 11:49:25chucknorrisSzitakötő (50 pont)cpp17Wrong answer 8/5048ms1600 KiB
#include <iostream>
#define MOD 1000000007

using namespace std;

int N, K, a[100002];
long long s[100002];

int main(){
    cin >> N >> K;
    for(int i = 1; i <= N; i++){
        cin >> a[i]; s[i] = s[i - 1] + a[i];
    }

    if(K == 1) cout << 0;
    else if(N == 3){
        if(K == 2){
            if(a[1] + a[2] < a[3]) cout << 0;
            else cout << 4;
        }
        else if(K == 3){
            if(a[1] + a[2] <= a[3]) cout << 8;
            else cout << 4;
        }
    }
    else{
        long long ans = 1, S = 0;
        int i = K;
        while(S < s[i]){
            S = S + a[i]; i = i - 1;
        }

        for( ; i >= 1; i--) ans = ans * 2 % MOD;

        if(K == N) cout << ans * 2 % MOD;
    }
    return 0;
}
SubtaskSumTestVerdictTimeMemory
base8/50
1Wrong answer0/01ms320 KiB
2Wrong answer0/046ms1336 KiB
3Accepted1/11ms320 KiB
4Accepted1/11ms320 KiB
5Wrong answer0/11ms320 KiB
6Accepted1/11ms320 KiB
7Accepted1/11ms500 KiB
8Wrong answer0/11ms320 KiB
9Wrong answer0/11ms320 KiB
10Wrong answer0/21ms332 KiB
11Wrong answer0/21ms408 KiB
12Wrong answer0/21ms320 KiB
13Wrong answer0/21ms320 KiB
14Wrong answer0/21ms320 KiB
15Wrong answer0/21ms320 KiB
16Wrong answer0/21ms508 KiB
17Wrong answer0/21ms584 KiB
18Wrong answer0/21ms508 KiB
19Wrong answer0/21ms420 KiB
20Wrong answer0/21ms508 KiB
21Wrong answer0/11ms424 KiB
22Wrong answer0/232ms1396 KiB
23Wrong answer0/235ms1432 KiB
24Wrong answer0/246ms1436 KiB
25Wrong answer0/246ms1376 KiB
26Accepted2/248ms1336 KiB
27Wrong answer0/218ms1476 KiB
28Wrong answer0/235ms1492 KiB
29Wrong answer0/232ms1516 KiB
30Wrong answer0/246ms1336 KiB
31Accepted2/243ms1600 KiB