Submission #1129075

#TimeUsernameProblemLanguageResultExecution timeMemory
1129075psm9352Sequence (APIO23_sequence)C++20
0 / 100
2095 ms4416 KiB
#include <vector> #include <algorithm> using namespace std; int sequence(const int n,const vector<int> arr){ int ans = 0; for (int l = 0;l<n;l++){ for (int r = l+1;r<n;r++){ vector<int> data(r-l+1); for (int i = l;i<=r;i++){ data[i-l]=arr[l]; } sort(data.begin(),data.end()); int s = r-l+1; int mid1 = data[s/2]; int mid2 = data[(s-1)/2]; ans = max((int)count(data.begin(),data.end(),mid1),ans); ans = max((int)count(data.begin(),data.end(),mid2),ans); } } 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...