Submission #751826

#TimeUsernameProblemLanguageResultExecution timeMemory
7518261075508020060209tcSequence (APIO23_sequence)C++17
11 / 100
2073 ms8408 KiB
#include <bits/stdc++.h> using namespace std; #define ll long long int lowbit(int x){return x&-x;} struct BIT{ vector<int>bit; }; int n; int ar[500005]; int freq[500005]; int slv(){ int ans=0; for(int l=1;l<=n;l++){ for(int r=l+1;r<=n;r++){ vector<int>vc; for(int i=1;i<=n;i++){ freq[i]=0; } for(int i=l;i<=r;i++){ vc.push_back(ar[i]); freq[ar[i]]++; } sort(vc.begin(),vc.end()); int k=r-l+1; ans=max(ans,max(freq[vc[(k-1)/2]],freq[vc[k/2]])); } } return ans; } int sequence(int N, std::vector<int> A) { n=N; for(int i=0;i<n;i++){ ar[i+1]=A[i]; } return slv(); return 0; } /* signed main() { return 0; } */
#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...