# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
985400 | ag_1204 | Sequence (APIO23_sequence) | C++17 | 2035 ms | 8368 KiB |
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 long long int
int sequence(int N, std::vector<int> A) {
int ans=0;
for (int i=0;i<N;i++) {
vector<int> v;
multiset<int> s;
for (int j=i;j<N;j++) {
v.push_back(A[j]);
s.insert(A[j]);
sort(v.begin(),v.end());
int m=size(v);
int k = m/2;
if (m%2==0) {
int s1=v[k], s2=v[k-1];
int t=max(s.count(s1),s.count(s2));
ans = max(k,ans);
} else {
int s1=v[k];
int r=s.count(s1);
ans = max(r,ans);
}
}
}
return ans;
}
Compilation message (stderr)
# | 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... |