#include<bits/stdc++.h>
using namespace std;
int main()
{
ios_base::sync_with_stdio(false);
int n,q;
cin >> n >> q;
vector<int>a(n+1,0);
vector<long long>b(n+1,0);
for(int i = 1;i<=n;i++)
{
cin >> a[i];
b[i] = a[i] -a[i-1];
}
int flag = 2;
int temp =2;
int c = b[2];
for(int i = 3;i<=n;i++)
{
if(b[i] == c)
{
temp++;
flag = max(flag,temp);
}
else
{
c = b[i];
temp = 2;
}
}
while(q--)
{
int k;
int r,l,s,c;
cin >> k;
if(k == 1)
{
cin >> l >> r >> s >> c;
}
else if (k==2)
{
cin >> l >> r >> s >> c;
flag = n;
}
else
{
cin >> l >> r;
cout << min(n,flag) << '\n';
}
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
220 ms |
4436 KB |
Output is correct |
2 |
Correct |
186 ms |
836 KB |
Output is correct |
3 |
Correct |
207 ms |
592 KB |
Output is correct |
4 |
Correct |
242 ms |
496 KB |
Output is correct |
5 |
Correct |
188 ms |
748 KB |
Output is correct |
6 |
Correct |
189 ms |
560 KB |
Output is correct |
7 |
Correct |
210 ms |
508 KB |
Output is correct |
8 |
Correct |
1 ms |
344 KB |
Output is correct |
9 |
Correct |
1 ms |
348 KB |
Output is correct |
10 |
Correct |
1 ms |
348 KB |
Output is correct |
11 |
Correct |
226 ms |
12420 KB |
Output is correct |
12 |
Correct |
220 ms |
12372 KB |
Output is correct |
13 |
Correct |
221 ms |
12820 KB |
Output is correct |
14 |
Correct |
259 ms |
12772 KB |
Output is correct |
15 |
Correct |
224 ms |
12628 KB |
Output is correct |
16 |
Correct |
219 ms |
12372 KB |
Output is correct |
17 |
Correct |
220 ms |
12456 KB |
Output is correct |
18 |
Correct |
275 ms |
12444 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
344 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
390 ms |
4948 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
202 ms |
4436 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
390 ms |
4948 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
220 ms |
4436 KB |
Output is correct |
2 |
Correct |
186 ms |
836 KB |
Output is correct |
3 |
Correct |
207 ms |
592 KB |
Output is correct |
4 |
Correct |
242 ms |
496 KB |
Output is correct |
5 |
Correct |
188 ms |
748 KB |
Output is correct |
6 |
Correct |
189 ms |
560 KB |
Output is correct |
7 |
Correct |
210 ms |
508 KB |
Output is correct |
8 |
Correct |
1 ms |
344 KB |
Output is correct |
9 |
Correct |
1 ms |
348 KB |
Output is correct |
10 |
Correct |
1 ms |
348 KB |
Output is correct |
11 |
Correct |
226 ms |
12420 KB |
Output is correct |
12 |
Correct |
220 ms |
12372 KB |
Output is correct |
13 |
Correct |
221 ms |
12820 KB |
Output is correct |
14 |
Correct |
259 ms |
12772 KB |
Output is correct |
15 |
Correct |
224 ms |
12628 KB |
Output is correct |
16 |
Correct |
219 ms |
12372 KB |
Output is correct |
17 |
Correct |
220 ms |
12456 KB |
Output is correct |
18 |
Correct |
275 ms |
12444 KB |
Output is correct |
19 |
Incorrect |
1 ms |
344 KB |
Output isn't correct |
20 |
Halted |
0 ms |
0 KB |
- |