Submission #981954

#TimeUsernameProblemLanguageResultExecution timeMemory
981954alo_54Sequence (APIO23_sequence)C++17
0 / 100
2035 ms4188 KiB
#include "sequence.h" #include <bits/stdc++.h> using namespace std; int techo(int k) { if (k % 2 == 0) { return k /2; } return (k/2) + 1; } int sequence(int N, std::vector<int> A) { int maxV = -1; for (int i = 0; i < N-1; i++) { for (int j = i + 1; j < N; i++) { vector <int> arr; for (int k = i; k <= j; k++) { arr.push_back(A[k]); } sort(arr.begin(), arr.end()); int p = arr.size()/2; int t = techo(arr.size()); maxV = max(maxV, max(arr[p], arr[t])); } } return maxV; }
#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...