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 <map>
#include <vector>
#include <set>
using namespace std;
int sequence(int N,vector<int> A)
{
int ans=1;
for (int i=0;i<N;i++)
{
multiset<int>s;
map<int,int>cnt;
for (int j=i;j<N;j++)
{
s.insert(A[j]);
cnt[A[j]]++;
if (s.size()%2==0)
{
int f=*(next(begin(s),s.size()/2));
int g=*next(begin(s),s.size()/2-1);
ans=max(ans,max(cnt[f],cnt[g]));
}
else
{
int f=*next(begin(s),s.size()/2);
ans=max(ans,cnt[f]);
}
}
}
return ans;
return 0;
}
# | 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... |