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 <vector>
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
int sequence(int N, vector<int> A) {
int ans=0;
for(int i=0; i<N; ++i){
for(int j=i; j<N; ++j){
vector<int> aux;
for(int x=i; x<=j; ++x){
aux.pb(A[x]);
}
sort(aux.begin(), aux.end());
int median=aux[(aux.size()-1)/2];
int help=0;
for(int x: aux){
if(x==median){
help++;
}
}
ans=max(ans, help);
median=aux[(aux.size()+1)/2];
help=0;
for(int x: aux){
if(x==median){
help++;
}
}
ans=max(ans, help);
}
}
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... |