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;
#define pb push_back
int sequence(int n, std::vector<int> a) {
int ans = 0;
for(int i = 0;i < n;i++){
for(int j = i;j < n;j++){
vector<int> b;
for(int k = i;k <= j;k++){
b.pb(a[k]);
}
sort(b.begin(),b.end());
set<int> st;
st.insert(b[(b.size() - 1) / 2]);
st.insert(b[(b.size()) / 2]);
for(auto k : st){
int cnt = 0;
for(int q = i;q <= j;q++){
cnt += (a[q] == k);
}
ans = max(ans,cnt);
}
}
}
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... |