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;
int sequence(int n, vector<int> a) {
int ans = 0;
for (int i = 0; i < n; ++i) {
multiset<int> x;
vector<int> mp(2100);
for (int j = i; j < n; ++j) {
x.insert(a[j]);
mp[a[j]]++;
int cnt = 0;
int d = (j - i) >> 1;
int b = (j - i + 1) >> 1;
int c1 = 0, c2 = 0;
for (auto k: x) {
if (cnt == d)
c1 = k;
if (cnt == b) {
c2 = k;
break;
}
++cnt;
}
if (mp[c1] > ans)
ans = mp[c1];
if (mp[c2] > ans)
ans = mp[c2];
// cout << x.count(c1) << endl;
// cout << x.count(c2) << endl;
}
}
return ans;
}
//int main() {
// int n;
// cin >> n;
// vector<int> a(n);
// for (int i = 0; i < n; ++i)
// cin >> a[i];
// cout << sequence(n, a);
// return 0;
//}
# | 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... |