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"
#define ll long long
#define pb push_back
#define fi first
#define se second
using namespace std;
const int N = 2e3+5;
int cnt[N];
int sequence(int n, vector<int> a)
{
int res = 1;
for(int i = 0;i<n;i++)
{
vector<int> ve;
for(int j = 1;j<=n;j++)
cnt[j]=0;
for(int j = i;j<n;j++)
{
ve.pb(a[j]);
sort(ve.begin(),ve.end());
cnt[a[j]]++;
int hlf = (ve.size()-1)/2;
res=max(res,cnt[ve[hlf]]);
if(ve.size()%2==0)
res=max(res,cnt[ve[hlf+1]]);
}
}
return res;
}
# | 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... |