182512025-10-16 10:50:04dfehervariÚthasználati díj (75 pont)cpp17Time limit exceeded 60/75298ms800 KiB
#include<iostream>
#include<vector>
#include<string>

int main(){
    //std::cout<<"Úthasználati díj\n";
    int N,k,db,i,j,utak;
    std::cin>>N>>k;
    std::vector<int> U(N);
    for(int i=0;i<N;++i){
        std::cin>>U[i];
    }
    db=0;
    i=0;
    utak=0;
    while(i<N){
        while(i<N and U[i]==0) ++i;
        if(i<N){
        db=1;
        j=i+1;
        while(j<N and db<k){
            if (U[j]==1){
                utak+=1;
                db+=1;
            }
            ++j;
            }
        }
        ++i;
    }
    std::cout<<utak;







    return 0;
}
SubtaskSumTestVerdictTimeMemory
base60/75
1Accepted0/01ms316 KiB
2Accepted0/01ms316 KiB
3Time limit exceeded0/0275ms564 KiB
4Accepted5/52ms316 KiB
5Accepted5/51ms316 KiB
6Accepted5/51ms316 KiB
7Accepted5/51ms316 KiB
8Accepted5/51ms316 KiB
9Accepted5/51ms316 KiB
10Accepted5/51ms316 KiB
11Accepted5/51ms316 KiB
12Accepted5/51ms508 KiB
13Accepted5/52ms500 KiB
14Accepted5/524ms800 KiB
15Accepted5/535ms564 KiB
16Time limit exceeded0/5298ms564 KiB
17Time limit exceeded0/5284ms564 KiB
18Time limit exceeded0/5282ms756 KiB