97512024-03-06 11:56:39UnluckYHőmérsékletekcpp17Accepted 100/10046ms6908 KiB
#include <bits/stdc++.h>

using namespace std;


int main(){


    int n, e; cin >> n >> e;
    vector<int> v;

    for (int i = 0; i < n; i++){
        int a; cin >> a; v.push_back(a);
    }

    int b = -1, j = -1, curr = 0;
    bool vanerossz = false;
    int maxi = 0;
    pair<int, int> maxis = {0, 0};

    while (b < n-1 && j < n-1){
        while (curr <= e && !vanerossz && j < n-1){
            j++;
            if (v[j] < 15 || v[j] > 25) curr++;
            if (v[j] < 10 || v[j] > 30) vanerossz = true;
            if (j-b > maxi && curr <= e && !vanerossz && j < n){
                maxi = j-b;
                maxis = {b, j};
            }
        }
        b++;
        if (v[b] < 15 || v[b] > 25) curr--;
        if (v[b] < 10 || v[b] > 30) vanerossz = false;
    }

    if (maxi == 0){
        cout << -1 << endl;
        return 0;
    }

    cout << maxis.first+2 << " " << maxis.second+1 << endl;



    return 0;
}
SubtaskSumTestVerdictTimeMemory
subtask10/0
1Accepted3ms1808 KiB
2Accepted3ms2060 KiB
subtask27/7
3Accepted3ms2308 KiB
4Accepted3ms2324 KiB
5Accepted3ms2332 KiB
6Accepted4ms2672 KiB
7Accepted24ms3660 KiB
8Accepted46ms4428 KiB
9Accepted3ms2616 KiB
subtask314/14
10Accepted3ms2816 KiB
11Accepted2ms2892 KiB
12Accepted3ms2892 KiB
13Accepted3ms3092 KiB
14Accepted3ms3096 KiB
15Accepted3ms3188 KiB
16Accepted3ms3192 KiB
subtask438/38
17Accepted2ms3184 KiB
18Accepted3ms3208 KiB
19Accepted3ms3440 KiB
20Accepted4ms3864 KiB
21Accepted4ms4136 KiB
22Accepted23ms5308 KiB
23Accepted25ms5332 KiB
24Accepted3ms4300 KiB
subtask541/41
25Accepted24ms5656 KiB
26Accepted46ms6556 KiB
27Accepted46ms6640 KiB
28Accepted46ms6592 KiB
29Accepted21ms5816 KiB
30Accepted45ms6696 KiB
31Accepted45ms6700 KiB
32Accepted46ms6768 KiB
33Accepted21ms5792 KiB
34Accepted21ms5800 KiB
35Accepted21ms5908 KiB
36Accepted3ms4676 KiB
37Accepted3ms4780 KiB
38Accepted45ms6828 KiB
39Accepted43ms6908 KiB