This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
// #pragma GCC optimize("O1,O2,O3,unroll-loops,Ofast")
// #pragma GCC target("avx2")
#include <bits/stdc++.h>
#include "sequence.h"
using namespace std;
#define lli long long int
#define MP make_pair
#define pb push_back
#define REP(i,n) for(int i = 0; (i) < (n); (i)++)
void fastio() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
}
const double EPS = 0.00001;
const int INF = 1e9+900;
const int N = 3e5+5;
const int ALPH = 26;
const int LGN = 25;
const int MOD = 1e9+7;
const int MXA = 1e9+5;
int m,q;
int sequence(int n, vector<int> a) {
int ans = 1;
for(int l = 0; l<n; l++) {
for(int r = l; r<n; r++) {
vector<int> tmp, freq(n + 1, 0);
for(int i = l; i<=r; i++) {
tmp.pb(a[i]);
freq[a[i]]++;
}
sort(tmp.begin(), tmp.end());
ans = max(ans , freq[tmp[tmp.size() / 2] ]);
if(tmp.size() % 2 == 0) {
ans = max(ans , freq[tmp[tmp.size() / 2 - 1] ]);
}
}
}
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... |