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>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
#define fi first
#define se second
#define mp make_pair
const int N = (int)5e5 + 10;
int cnt[N];
int sequence(int n, vector<int> a) {
int ans = 0;
for(int i = 0 ; i < n; i ++) {
vector<int> me;
for(int j = i ; j < n; j ++) {
cnt[a[j]] ++ ;
me.push_back(a[j]);
sort(me.begin(), me.end());
if(me.size() % 2 == 0){
ans = max(ans, cnt[me[me.size() / 2]]);
ans = max(ans, cnt[me[me.size() / 2 - 1]]);
}
else{
ans = max(ans, cnt[me[me.size() / 2]]);
}
}
for(auto x : me) cnt[x] = 0;
}
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... |