제출 #984824

#제출 시각아이디문제언어결과실행 시간메모리
984824Muhammad_Aneeq서열 (APIO23_sequence)C++17
11 / 100
2048 ms10356 KiB
#include "sequence.h" #include <map> #include <vector> #include <set> using namespace std; int sequence(int N,vector<int> A) { int ans=1; for (int i=0;i<N;i++) { multiset<int>s; map<int,int>cnt; for (int j=i;j<N;j++) { s.insert(A[j]); cnt[A[j]]++; if (s.size()%2==0) { int f=*(next(begin(s),s.size()/2)); int g=*next(begin(s),s.size()/2-1); ans=max(ans,max(cnt[f],cnt[g])); } else { int f=*next(begin(s),s.size()/2); ans=max(ans,cnt[f]); } } } 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...