138342025-01-08 20:47:13reveszbercelVirágos rét (50 pont)cpp17Wrong answer 4/50300ms12828 KiB
#include <iostream>
#include <vector>
using namespace std;

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

    vector <int> ret(0);

    for (int i=0; i<n; i++){
        cin >> a;
        if (a==1){
            ret.push_back(i);
            retcount++;
        }
    }
    if (ret.size()<k || retcount<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/0282ms12592 KiB
4Wrong answer0/21ms316 KiB
5Accepted2/21ms316 KiB
6Accepted2/21ms316 KiB
7Wrong answer0/31ms316 KiB
8Wrong answer0/31ms404 KiB
9Wrong answer0/31ms316 KiB
10Wrong answer0/22ms316 KiB
11Wrong answer0/393ms3972 KiB
12Wrong answer0/229ms1424 KiB
13Wrong answer0/37ms564 KiB
14Wrong answer0/217ms944 KiB
15Time limit exceeded0/2273ms10772 KiB
16Time limit exceeded0/3300ms12724 KiB
17Time limit exceeded0/3279ms12324 KiB
18Time limit exceeded0/3279ms11416 KiB
19Wrong answer0/3126ms5936 KiB
20Time limit exceeded0/3300ms12824 KiB
21Time limit exceeded0/3300ms12828 KiB
22Time limit exceeded0/3277ms10920 KiB