Submission #985121

#TimeUsernameProblemLanguageResultExecution timeMemory
985121Muhammad_AneeqSequence (APIO23_sequence)C++17
0 / 100
2066 ms8120 KiB
#include "sequence.h" #include <vector> #include <set> using namespace std; int sequence(int N,vector<int> A) { int ans=1; int cnt[N+10]={}; multiset<int>s; for (int i=0;i<N;i++) { for (int j=i;j<N;j++) { s.insert(A[j]); cnt[A[j]]++; auto f=(next(begin(s),s.size()/2)); if (s.size()%2==0) { ans=max(ans,cnt[*f]); f++; ans=max(ans,cnt[*f]); } else ans=max(ans,cnt[*f]); } s={}; for (int j=i;j<N;j++) cnt[A[j]]--; } return ans; 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...