J. Time Limit

Codeforces
IDCF10222J
Time2000ms
Memory512MB
Difficulty
English · Original
Formal · Original
In CCPC contests, you will get "Time Limit Exceeded" when your program tried to run during too much time. Setting suitable time limit for problems is vital to a contest. Mr. Bread is preparing problems for a coming contest with his friends. For each problem, there will be a "Main Correct Solution" denotes the standard solution program written by the author. There will also be several "Correct Solutions" denote solution programs intended to pass. Assume there are $n$ programs in total, labeled by $1, 2, \\dots, n$. The $1$-th program denotes the "Main Correct Solution" while others are "Correct Solutions". The $i$-th program runs in $a_i$ seconds. According to the rules in Mr. Bread's mind, the time limit $x$ should meet all the rules below: Please write a program to find the time limit $x$. The first line of the input contains an integer $T (1 <= T <= 10)$, denoting the number of test cases. In each test case, there is one integer $n (2 <= n <= 10)$ in the first line, denoting the number of programs. In the second line, there are $n$ integers $a_1, a_2,..., a_n (1 <= a_i <= 10)$. For each test case, print a single line containing an integer, denoting the value of $x$. ## Input The first line of the input contains an integer $T (1 <= T <= 10)$, denoting the number of test cases.In each test case, there is one integer $n (2 <= n <= 10)$ in the first line, denoting the number of programs.In the second line, there are $n$ integers $a_1, a_2,..., a_n (1 <= a_i <= 10)$. ## Output For each test case, print a single line containing an integer, denoting the value of $x$. [samples]
**Definitions** Let $ P, Q \in \mathbb{R}^2 $ be two fixed pivot points. Let $ A = \{A_1, A_2, \dots, A_n\} \subset \mathbb{R}^2 $ be a set of $ n $ distinct points, none lying on line $ \overleftrightarrow{PQ} $. For any point $ A_i \in A $, define the **orientation** relative to triangle $ \triangle PQA_j $ as: $ A_i $ is **inside** $ \triangle PQA_j $ (excluding boundary) if it lies in the interior of the triangle formed by $ P, Q, A_j $. A **nested triangle sequence** is a strictly increasing sequence of indices $ v_1 < v_2 < \dots < v_k $ such that for all $ i \geq 2 $, point $ A_{v_i} $ lies strictly inside triangle $ \triangle P Q A_{v_{i-1}} $. **Constraints** 1. $ 1 \leq T \leq 1000 $ 2. For each test case: - $ 1 \leq n \leq 10^5 $ - Coordinates of $ P, Q, A_i \in [-10^9, 10^9] $ - All points distinct; no $ A_i $ lies on line $ \overleftrightarrow{PQ} $ - Sum of $ n $ over all test cases $ \leq 10^6 $ **Objective** Find the **maximum length** $ k $ of a nested triangle sequence $ v_1, v_2, \dots, v_k $, and among all such sequences of maximum length, return the **lexicographically smallest** one. Lexicographic minimality: For two sequences $ \mathbf{v} = (v_1, \dots, v_k) $ and $ \mathbf{u} = (u_1, \dots, u_k) $, $ \mathbf{v} < \mathbf{u} $ iff there exists $ i \in \{1, \dots, k\} $ such that $ v_j = u_j $ for all $ j < i $ and $ v_i < u_i $.
API Response (JSON)
{
  "problem": {
    "name": "J. Time Limit",
    "description": {
      "content": "In CCPC contests, you will get \"Time Limit Exceeded\" when your program tried to run during too much time. Setting suitable time limit for problems is vital to a contest. Mr. Bread is preparing proble",
      "description_type": "Markdown"
    },
    "platform": "Codeforces",
    "limit": {
      "time_limit": 2000,
      "memory_limit": 524288
    },
    "difficulty": "None",
    "is_remote": true,
    "is_sync": true,
    "sync_url": null,
    "sign": "CF10222J"
  },
  "statements": [
    {
      "statement_type": "Markdown",
      "content": "In CCPC contests, you will get \"Time Limit Exceeded\" when your program tried to run during too much time. Setting suitable time limit for problems is vital to a contest.\n\nMr. Bread is preparing proble...",
      "is_translate": false,
      "language": "English"
    },
    {
      "statement_type": "Markdown",
      "content": "**Definitions**  \nLet $ P, Q \\in \\mathbb{R}^2 $ be two fixed pivot points.  \nLet $ A = \\{A_1, A_2, \\dots, A_n\\} \\subset \\mathbb{R}^2 $ be a set of $ n $ distinct points, none lying on line $ \\overleft...",
      "is_translate": false,
      "language": "Formal"
    }
  ]
}
Full JSON Raw Segments