152272025-02-17 08:39:23szjSzitakötő (50 pont)cpp17Wrong answer 4/5045ms764 KiB
#include <bits/stdc++.h>
#define ma 1000000007
using namespace std;
int main()
{
    //ifstream cin("f.txt");
    int n, k, i, elsum=0, jobbsum, usum=0;
    long long int lehet = 1;
    cin >> n >> k;
    k--;
    if(k==0)
    {
        cout << 0;
        return 0;
    }
    int a[n];
    for(i=0; i<k; i++)
    {
        cin >> a[i];
        elsum+=a[i];
    }
    cin >> a[k];
    jobbsum = a[k]+elsum;
    for(i=k+1; i<n; i++)
    {
        cin >> a[i];
        usum+=a[i];
    }
    for(i=k-1; i>=0; i--)
    {
        if(elsum <= a[k])break;
        elsum-=a[i];
        a[k]+=a[i];
    }
    for(i; i>=0; i--)
    {
        lehet*=2;
        lehet%=ma;
    }
    a[k] = jobbsum;
    for(i=k+1; i<n; i++)
    {
        if(a[k] >= usum)break;
        elsum-=a[i];
        a[k]+=a[i];
    }
    for(i; i<n; i++)
    {
        lehet*=2;
        lehet%=ma;
    }
    cout << lehet;
    return 0;
}
SubtaskSumTestVerdictTimeMemory
base4/50
1Accepted0/01ms316 KiB
2Wrong answer0/045ms560 KiB
3Accepted1/11ms316 KiB
4Accepted1/11ms316 KiB
5Wrong answer0/11ms316 KiB
6Wrong answer0/11ms316 KiB
7Wrong answer0/11ms508 KiB
8Wrong answer0/11ms316 KiB
9Wrong answer0/11ms316 KiB
10Wrong answer0/21ms316 KiB
11Wrong answer0/21ms316 KiB
12Wrong answer0/21ms500 KiB
13Wrong answer0/21ms316 KiB
14Accepted2/21ms316 KiB
15Wrong answer0/21ms400 KiB
16Wrong answer0/21ms316 KiB
17Wrong answer0/21ms316 KiB
18Wrong answer0/21ms316 KiB
19Wrong answer0/21ms328 KiB
20Wrong answer0/21ms388 KiB
21Wrong answer0/11ms500 KiB
22Wrong answer0/232ms748 KiB
23Wrong answer0/234ms752 KiB
24Wrong answer0/245ms564 KiB
25Wrong answer0/245ms732 KiB
26Wrong answer0/245ms748 KiB
27Wrong answer0/217ms636 KiB
28Wrong answer0/235ms564 KiB
29Wrong answer0/232ms668 KiB
30Wrong answer0/245ms764 KiB
31Wrong answer0/241ms748 KiB