Submission #983220

#TimeUsernameProblemLanguageResultExecution timeMemory
983220vjudge1Sequence (APIO23_sequence)C++17
11 / 100
2072 ms8012 KiB
#include <bits/stdc++.h> using namespace std; #define pb push_back int sequence(int n, std::vector<int> a) { int ans = 0; for(int i = 0;i < n;i++){ for(int j = i;j < n;j++){ vector<int> b; for(int k = i;k <= j;k++){ b.pb(a[k]); } sort(b.begin(),b.end()); set<int> st; st.insert(b[(b.size() - 1) / 2]); st.insert(b[(b.size()) / 2]); for(auto k : st){ int cnt = 0; for(int q = i;q <= j;q++){ cnt += (a[q] == k); } 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...