Second Best

AtCoder
IDabc365_b
Time2000ms
Memory256MB
Difficulty
You are given an integer sequence $A=(A_1,\ldots,A_N)$ of length $N$. Here, $A_1, A_2, \ldots, A_N$ are all distinct. Which element in $A$ is the second largest? ## Constraints * $2 \leq N \leq 100$ * $1 \leq A_i \leq 10^9$ * $A_1, A_2, \ldots, A_N$ are all distinct. * All input values are integers. ## Input The input is given from Standard Input in the following format: $N$ $A_1$ $A_2$ $\ldots$ $A_{N}$ [samples]
Samples
Input #1
4
8 2 5 1
Output #1
3

The second largest element in $A$ is $A_3$, so print $3$.
Input #2
8
1 2 3 4 5 10 9 11
Output #2
6
API Response (JSON)
{
  "problem": {
    "name": "Second Best",
    "description": {
      "content": "You are given an integer sequence $A=(A_1,\\ldots,A_N)$ of length $N$. Here, $A_1, A_2, \\ldots, A_N$ are all distinct. Which element in $A$ is the second largest?",
      "description_type": "Markdown"
    },
    "platform": "AtCoder",
    "limit": {
      "time_limit": 2000,
      "memory_limit": 262144
    },
    "difficulty": "None",
    "is_remote": true,
    "is_sync": true,
    "sync_url": null,
    "sign": "abc365_b"
  },
  "statements": [
    {
      "statement_type": "Markdown",
      "content": "You are given an integer sequence $A=(A_1,\\ldots,A_N)$ of length $N$. Here, $A_1, A_2, \\ldots, A_N$ are all distinct.\nWhich element in $A$ is the second largest?\n\n## Constraints\n\n*   $2 \\leq N \\leq 10...",
      "is_translate": false,
      "language": "English"
    }
  ]
}
Full JSON Raw Segments