#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 << flag << '\n';
}
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
221 ms |
4432 KB |
Output is correct |
2 |
Correct |
183 ms |
3588 KB |
Output is correct |
3 |
Correct |
190 ms |
3664 KB |
Output is correct |
4 |
Correct |
182 ms |
3664 KB |
Output is correct |
5 |
Correct |
190 ms |
3580 KB |
Output is correct |
6 |
Correct |
190 ms |
3620 KB |
Output is correct |
7 |
Correct |
185 ms |
3548 KB |
Output is correct |
8 |
Incorrect |
1 ms |
344 KB |
Output isn't correct |
9 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
348 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
381 ms |
5028 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
200 ms |
4572 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
381 ms |
5028 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
221 ms |
4432 KB |
Output is correct |
2 |
Correct |
183 ms |
3588 KB |
Output is correct |
3 |
Correct |
190 ms |
3664 KB |
Output is correct |
4 |
Correct |
182 ms |
3664 KB |
Output is correct |
5 |
Correct |
190 ms |
3580 KB |
Output is correct |
6 |
Correct |
190 ms |
3620 KB |
Output is correct |
7 |
Correct |
185 ms |
3548 KB |
Output is correct |
8 |
Incorrect |
1 ms |
344 KB |
Output isn't correct |
9 |
Halted |
0 ms |
0 KB |
- |