Submission #981954

# Submission time Handle Problem Language Result Execution time Memory
981954 2024-05-13T17:08:00 Z alo_54 Sequence (APIO23_sequence) C++17
0 / 100
2000 ms 4188 KB
#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 time Memory Grader output
1 Execution timed out 2017 ms 412 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 2017 ms 412 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 2017 ms 412 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 2032 ms 348 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 2035 ms 4188 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 2017 ms 412 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 2017 ms 412 KB Time limit exceeded
2 Halted 0 ms 0 KB -