108052024-04-14 15:04:02eokorSzitakötő (50 pont)cpp17Wrong answer 2/5054ms5428 KiB
#include <bits/stdc++.h>

using namespace std;

int main()
{
    //ifstream cin("be.txt");
    vector <int> a;
    long long int n,k,osszeg1=0,osszeg2=0,p,x;
    cin>>n>>k;
    a.push_back(0);
    for(long long int i=1;i<k;i++)
        {
            cin>>x;
            a.push_back(x);
            osszeg1+=x;
        }
        cin>>x;
        a.push_back(x);
    for(long long int i=1;i<=n-k;i++)
        {
            cin>>x;
            a.push_back(x);
            osszeg2+=x;
        }
    long long int meg=1;

    if(k==1)
    {
        meg=0;
    }

    x=0;
    p=osszeg1+a[k];
    while(osszeg1>a[k]){
        x++;
        osszeg1-=a[k-x];
    }
    int mod=pow(10,9)+7;
    for(long long int i=1;i<k-x;i++)
    {
     meg*=2;
     meg=meg%mod;
    }
    x=0;
    while(osszeg2>=p){
        x++;
        osszeg2-=a[k+x];

    }
    if(x==0)
        x=1;
    for(long long int i=k+x;i<=n;i++)
    {
     meg*=2;
     meg%=mod;
    }
    meg%=mod;

    cout<<meg;
    return 0;
}
 
SubtaskSumTestVerdictTimeMemory
base2/50
1Accepted0/03ms1812 KiB
2Wrong answer0/054ms3180 KiB
3Accepted1/13ms2268 KiB
4Accepted1/13ms2424 KiB
5Wrong answer0/13ms2656 KiB
6Wrong answer0/12ms2584 KiB
7Wrong answer0/13ms2712 KiB
8Wrong answer0/13ms2928 KiB
9Wrong answer0/13ms3132 KiB
10Wrong answer0/23ms3248 KiB
11Wrong answer0/22ms3320 KiB
12Wrong answer0/22ms3432 KiB
13Wrong answer0/23ms3324 KiB
14Wrong answer0/23ms3328 KiB
15Wrong answer0/23ms3328 KiB
16Wrong answer0/23ms3468 KiB
17Wrong answer0/23ms3468 KiB
18Wrong answer0/23ms3472 KiB
19Wrong answer0/23ms3468 KiB
20Wrong answer0/23ms3472 KiB
21Wrong answer0/13ms3472 KiB
22Wrong answer0/237ms4596 KiB
23Wrong answer0/239ms4684 KiB
24Wrong answer0/252ms4600 KiB
25Wrong answer0/254ms4812 KiB
26Wrong answer0/252ms4812 KiB
27Wrong answer0/220ms5032 KiB
28Wrong answer0/239ms5024 KiB
29Wrong answer0/237ms5428 KiB
30Wrong answer0/254ms5384 KiB
31Wrong answer0/248ms5384 KiB