138312025-01-08 20:42:43reveszbercelVirágos rét (50 pont)cpp17Wrong answer 4/50300ms12832 KiB
#include <iostream>
#include <vector>
using namespace std;

int main() {
    int n, k;
    cin >> n >> k;
    int a;

    vector <int> ret(0);

    for (int i=0; i<n; i++){
        cin >> a;
        if (a==1){
            ret.push_back(i);
        }
    }
    if (ret.size()<k){
        cout << 0;
        return 0;
    }  
    
    for (int i=0; i<ret.size()-k+1; i++){
        for (int j=i+k-1; j<ret.size(); j++){

            cout << ret[i]+1 << "-" << ret[j]+1;
            if (j<ret.size()-1){
                cout << ", ";
            }
        }


        if (i<ret.size()-k){
            cout << ", ";
        }
    }

    
}
SubtaskSumTestVerdictTimeMemory
base4/50
1Wrong answer0/01ms316 KiB
2Accepted0/01ms316 KiB
3Time limit exceeded0/0280ms12340 KiB
4Wrong answer0/21ms316 KiB
5Accepted2/21ms316 KiB
6Accepted2/21ms316 KiB
7Wrong answer0/31ms316 KiB
8Wrong answer0/31ms316 KiB
9Wrong answer0/31ms316 KiB
10Wrong answer0/22ms316 KiB
11Wrong answer0/394ms3796 KiB
12Wrong answer0/228ms1340 KiB
13Wrong answer0/37ms596 KiB
14Wrong answer0/217ms976 KiB
15Time limit exceeded0/2300ms11908 KiB
16Time limit exceeded0/3300ms12428 KiB
17Time limit exceeded0/3279ms12344 KiB
18Time limit exceeded0/3280ms11436 KiB
19Wrong answer0/3126ms6036 KiB
20Time limit exceeded0/3300ms12832 KiB
21Time limit exceeded0/3277ms11440 KiB
22Time limit exceeded0/3277ms11072 KiB