Submission #814622

#TimeUsernameProblemLanguageResultExecution timeMemory
814622HanksburgerSequence (APIO23_sequence)C++17
7 / 100
77 ms11588 KiB
#include "sequence.h" #include <bits/stdc++.h> using namespace std; int freq[500005]; vector<int> b; int sequence(int n, vector<int> a) { for (int i=0; i<n; i++) freq[a[i]]++; b=a; sort(b.begin(), b.end()); int cnt=1, ans=0; for (int i=(n-1)/2; i<n; i++) ans=max(ans, freq[b[i]]); for (int i=1; i<n; i++) { if (a[i]==a[i-1]) cnt++; else { ans=max(ans, cnt); cnt=1; } } ans=max(ans, cnt); 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...