Submission #1088998

#TimeUsernameProblemLanguageResultExecution timeMemory
1088998Math4Life2020Sequence (APIO23_sequence)C++17
11 / 100
2101 ms5204 KiB
#include <bits/stdc++.h> using namespace std; using ll = long long; using pii = pair<ll,ll>; int sequence(int N, vector<int> A) { ll ans = 0; for (ll l=0;l<N;l++) { for (ll r=l;r<N;r++) { vector<int> elems; for (ll t=l;t<=r;t++) { elems.push_back(A[t]); } sort(elems.begin(),elems.end()); ll S = elems.size(); ll v1 = elems[(S-1)/2]; ll n1 = 0; ll v2 = elems[(S)/2]; ll n2 = 0; for (ll x: elems) { if (x==v1) { n1++; } if (x==v2) { n2++; } } ans = max(ans,n1); ans = max(ans,n2); } } return ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...