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 <bits/stdc++.h>
#include "sequence.h"
using namespace std;
#define sz(s) (int)s.size()
int sequence(int n, vector<int> a) {
int ans = 0;
for(int i = 0; i < n; i++){
vector <int> v, b(n,0);
for(int j = i; j < n; j++){
v.push_back(a[j]);
b[a[j]]++;
for(int k = sz(v)-2; k >= 0; k--){
if(v[k] > v[k+1]){
swap(v[k],v[k+1]);
}
else {
break;
}
}
int x = sz(v), c = (x-1)/2, c1 = (x/2);
ans = max(ans,b[v[c]]);
ans = max(ans,b[v[c1]]);
}
}
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... |