This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "sequence.h"
#include <bits/stdc++.h>
using namespace std;
int sequence(int n, vector<int> a) {
int ans = 0;
for(int i=0; i<n; i++){
int sum=0, col=0;
for(int j=i; j>=0; j--){
if(a[i] == a[j]) col++;
if(a[i] < a[j]) sum --;
if(a[i] > a[j]) sum ++;
if(abs(sum) <= col) ans = max(ans, col);
//cout<<i<<' '<<j<<' '<<col<<' '<<sum<<'\n';
}
}
return ans;
}
# | 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... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |