#include "sequence.h"
#include <bits/stdc++.h>
using namespace std;
int f(vector<int> lol)
{
int n = lol.size();
sort(lol.begin(),lol.end());
if(lol.size() % 2 == 0)
{
int fi = lol[n / 2 - 1], se = lol[n / 2];
return max(count(lol.begin(),lol.end(),fi), count(lol.begin(),lol.end(),se));
}
else
{
return count(lol.begin(),lol.end(), lol[n / 2]);
}
}
int sequence(int n, std::vector<int> A) {
int mx = -1;
for(int i=0;i<n;++i)
{
vector<int> lol;
for(int j=i;j<n;++j)
{
lol.push_back(A[j]);
mx = max(mx, f(lol));
}
}
return mx;
}
# | 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... |