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>
using namespace std;
using ll = long long; using pii = pair<ll,ll>;
int sequence(int N, vector<int> A) {
ll ans = 0;
for (ll l=0;l<N;l++) {
for (ll r=l;r<N;r++) {
vector<int> elems;
for (ll t=l;t<=r;t++) {
elems.push_back(A[t]);
}
sort(elems.begin(),elems.end());
ll S = elems.size();
ll v1 = elems[S/2];
ll n1 = 0;
ll v2 = elems[(S+1)/2];
ll n2 = 0;
for (ll x: elems) {
if (x==v1) n1++;
if (x==v2) n2++;
}
ans = max(ans,n1);
ans = max(ans,n2);
}
}
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... |