제출 #984826

#제출 시각아이디문제언어결과실행 시간메모리
984826Muhammad_Aneeq서열 (APIO23_sequence)C++17
11 / 100
2075 ms7880 KiB
#include "sequence.h" #include <map> #include <vector> #include <set> using namespace std; int sequence(int N,vector<int> A) { int ans=1; int cnt[N+10]={}; for (int i=0;i<N;i++) { multiset<int>s; 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]); } } 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...