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 <bits/stdc++.h>
#define ll long long
using namespace std;
const ll N=3e5+9,M=2e18+9,L=18,mod=1e9+7;
ll n,x,y;
multiset<ll>s;
map<ll,ll>m;
int sequence(int N, vector<int> A) {
ll ans=1;
for(ll i=0;i<N;++i)
{
s.clear();
m.clear();
s.insert(A[i]);
auto k=s.begin();
//x=1;
for(ll j=i+1;j<N;++j)
{
s.insert(A[j]);
++m[A[j]];
ans=max(ans,m[*k]);
if((j-i)%2)++k,++x;
ans=max(ans,m[*k]);
//cout<<i<<' '<<j<<' '<<x<<'\n';
}
}
return ans;
}
/*
int main()
{
ios::sync_with_stdio(0);
cin.tie(0);cout.tie(0);
cin>>n;
vector<int>v(n);
for(auto &i:v)cin>>i;
cout<<sequence(n,v);
}
*/
# | 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... |