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 ff first
#define ss second
#define all(v) v.begin(), v.end()
#define ll long long
#define pb push_back
#define pii pair<int, int>
#define wr puts("----------------")
template<class T>bool umin(T& a,T b){if(a>b){a=b;return 1;}return 0;}
template<class T>bool umax(T& a,T b){if(a<b){a=b;return 1;}return 0;}
int sequence(int n, vector<int> v){
vector<int> A;
int answer = 0;
for(int i = 0; i < n; ++i){
for(int j = i; j < n; ++j){
A.pb(v[j]);
vector<int> same = A;
sort(all(same));
int N = (int)same.size();
set<int> s;
s.insert(same[(N-1)>>1]);
s.insert(same[N>>1]);
for(int x : s)
umax(answer, (int)count(all(same), x));
}
A.clear();
}
return answer;
}
// int main(){
// printf("%d\n", sequence(7, {1, 2, 3, 1, 2, 1, 3}));
// 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... |