#include <iostream>
#include <vector>
#include <string>
using namespace std;
void evaluate(int A[], int l, int r){
if (r - l == 0){
cout << "1\n";
return;
}
if (r - l == 1){
cout << "2\n";
return;
}
int length, max;
length = 2;
max = 2;
for (int k = 0; k < r - l; k++){
if (A[k+l] == A[k+l-1]){
length++;
}
else{length = 2;}
if (max < length){
max = length;
}
}
cout << max << "\n";
}
int main(){
ios_base::sync_with_stdio(false);
int t, q, input, L, R, a, b, c, d;
cin >> t >> q;
int stages[t];
int differences[t];
for (int i = 0; i < t; i++){
cin >> stages[i];
}
for (int i = 0; i < t - 1; i++){
differences[i] = stages[i+1] - stages[i];
}
for (int j = 0; j < q; j++){
cin >> input;
if (input == 3){
cin >> L >> R;
evaluate(differences, L, R);
}
else if (input == 1){
cin >> a >> b >> c >> d;
}
else if (input == 2){
cin >> a >> b >> c >> d;
}
}
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |