182492025-10-16 10:48:57dfehervariÚthasználati díj (75 pont)cpp17Wrong answer 0/75300ms1004 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
base0/75
1Wrong answer0/01ms316 KiB
2Wrong answer0/01ms316 KiB
3Time limit exceeded0/0282ms820 KiB
4Wrong answer0/51ms316 KiB
5Wrong answer0/51ms316 KiB
6Wrong answer0/51ms316 KiB
7Wrong answer0/51ms316 KiB
8Wrong answer0/51ms508 KiB
9Wrong answer0/51ms316 KiB
10Wrong answer0/51ms316 KiB
11Wrong answer0/51ms316 KiB
12Wrong answer0/51ms316 KiB
13Wrong answer0/51ms316 KiB
14Wrong answer0/523ms820 KiB
15Wrong answer0/537ms820 KiB
16Time limit exceeded0/5298ms776 KiB
17Time limit exceeded0/5275ms820 KiB
18Time limit exceeded0/5300ms1004 KiB