3598 | 2023-03-01 09:36:42 | kdb | Hőmérsékletek | cpp11 | Accepted 100/100 | 19ms | 13492 KiB |
#include <iostream>
#include <vector>
using namespace std;
int main()
{
cin.tie(nullptr);
cout.tie(nullptr);
ios_base::sync_with_stdio(false);
int n,e;
cin>>n>>e;
vector<int>vec(n);
for(int i = 0;i<n;i++)
{
cin>>vec[i];
}
int i = 0, j = 0, maxk = 1, maxv = 0, db =0;
for(int j =0;j<n;j++)
{
if(vec[j] > 30 || vec[j] < 10)
{
i = j + 1;
db = 0;
continue;
}
else if((vec[j] >= 10 && vec[j]<=14) || (vec[j]>=26 && vec[j]<=30))
{
db++;
if(db>e)
{
while(!((vec[i] >= 10 && vec[i]<=14) || (vec[i]>=26 && vec[i]<=30))) {i++;}
i++;
db--;
}
}
if((vec[j] <= 30 || vec[j] >= 10) && j-i>maxv-maxk)
{
maxk = i;
maxv = j;
}
}
if(maxk == 1 && maxv == 0) cout <<-1<<"\n";
else cout<<maxk + 1<<" "<<maxv + 1<<"\n";
return 0;
}
/*
11 2
28 25 34 30 21 20 29 10 18 15 9
15 10
30 25 14 13 14 20 20 16 24 28 22 30 28 11 14
*/
Subtask | Sum | Test | Verdict | Time | Memory | ||
---|---|---|---|---|---|---|---|
subtask1 | 0/0 | ||||||
1 | Accepted | 3ms | 1832 KiB | ||||
2 | Accepted | 3ms | 2052 KiB | ||||
subtask2 | 7/7 | ||||||
3 | Accepted | 3ms | 2228 KiB | ||||
4 | Accepted | 3ms | 2484 KiB | ||||
5 | Accepted | 3ms | 2636 KiB | ||||
6 | Accepted | 4ms | 3000 KiB | ||||
7 | Accepted | 10ms | 3892 KiB | ||||
8 | Accepted | 19ms | 5392 KiB | ||||
9 | Accepted | 2ms | 4080 KiB | ||||
subtask3 | 14/14 | ||||||
10 | Accepted | 3ms | 4180 KiB | ||||
11 | Accepted | 3ms | 4272 KiB | ||||
12 | Accepted | 2ms | 4368 KiB | ||||
13 | Accepted | 3ms | 4392 KiB | ||||
14 | Accepted | 3ms | 4508 KiB | ||||
15 | Accepted | 3ms | 4596 KiB | ||||
16 | Accepted | 3ms | 4596 KiB | ||||
subtask4 | 38/38 | ||||||
17 | Accepted | 3ms | 4808 KiB | ||||
18 | Accepted | 2ms | 4800 KiB | ||||
19 | Accepted | 3ms | 5028 KiB | ||||
20 | Accepted | 3ms | 5000 KiB | ||||
21 | Accepted | 3ms | 5028 KiB | ||||
22 | Accepted | 9ms | 5972 KiB | ||||
23 | Accepted | 10ms | 6380 KiB | ||||
24 | Accepted | 3ms | 5644 KiB | ||||
subtask5 | 41/41 | ||||||
25 | Accepted | 9ms | 6572 KiB | ||||
26 | Accepted | 18ms | 8020 KiB | ||||
27 | Accepted | 18ms | 8708 KiB | ||||
28 | Accepted | 18ms | 9456 KiB | ||||
29 | Accepted | 9ms | 9000 KiB | ||||
30 | Accepted | 18ms | 10416 KiB | ||||
31 | Accepted | 18ms | 10872 KiB | ||||
32 | Accepted | 18ms | 11544 KiB | ||||
33 | Accepted | 9ms | 11340 KiB | ||||
34 | Accepted | 9ms | 11372 KiB | ||||
35 | Accepted | 9ms | 11640 KiB | ||||
36 | Accepted | 3ms | 11124 KiB | ||||
37 | Accepted | 3ms | 11172 KiB | ||||
38 | Accepted | 18ms | 12920 KiB | ||||
39 | Accepted | 18ms | 13492 KiB |