97502024-03-06 11:55:35UnluckYHőmérsékletekcpp17Wrong answer 0/10046ms13524 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;
    }

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



    return 0;
}
SubtaskSumTestVerdictTimeMemory
subtask10/0
1Accepted3ms1856 KiB
2Accepted3ms2092 KiB
subtask20/7
3Accepted3ms2428 KiB
4Accepted3ms2588 KiB
5Accepted3ms2576 KiB
6Accepted4ms2956 KiB
7Accepted24ms4260 KiB
8Accepted46ms5824 KiB
9Wrong answer3ms4012 KiB
subtask30/14
10Accepted3ms4084 KiB
11Accepted3ms4100 KiB
12Accepted3ms4096 KiB
13Accepted3ms4232 KiB
14Accepted3ms4336 KiB
15Wrong answer3ms4496 KiB
16Wrong answer3ms4452 KiB
subtask40/38
17Accepted3ms4348 KiB
18Accepted3ms4420 KiB
19Accepted3ms4424 KiB
20Accepted4ms4660 KiB
21Accepted4ms4840 KiB
22Accepted23ms6132 KiB
23Accepted24ms6412 KiB
24Wrong answer3ms5348 KiB
subtask50/41
25Accepted23ms6728 KiB
26Accepted46ms8172 KiB
27Accepted45ms8932 KiB
28Accepted46ms9568 KiB
29Accepted21ms8932 KiB
30Accepted45ms10352 KiB
31Accepted45ms10940 KiB
32Accepted45ms11528 KiB
33Accepted21ms11124 KiB
34Accepted21ms11400 KiB
35Accepted21ms11512 KiB
36Wrong answer3ms10528 KiB
37Wrong answer3ms10536 KiB
38Accepted43ms12952 KiB
39Accepted43ms13524 KiB