Next

AtCoder
IDabc329_b
Time2000ms
Memory256MB
Difficulty
You are given $N$ integers $A_1, A_2, \ldots, A_N$. Find the largest among those integers that are not the largest. The constraints of this problem guarantee that the answer exists. ## Constraints * $2 \leq N \leq 100$ * $1 \leq A_i \leq 100$ * It is not the case that all $A_1, A_2, \ldots, A_N$ are equal. * 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
5
2 1 3 3 2
Output #1
2

The largest integer among $2,1,3,3,2$ is $3$.
The integers that are not $3$ among $2,1,3,3,2$ are $2,1,2$, among which the largest is $2$.
Input #2
4
4 3 2 1
Output #2
3
Input #3
8
22 22 18 16 22 18 18 22
Output #3
18
API Response (JSON)
{
  "problem": {
    "name": "Next",
    "description": {
      "content": "You are given $N$ integers $A_1, A_2, \\ldots, A_N$. Find the largest among those integers that are not the largest. The constraints of this problem guarantee that the answer exists.",
      "description_type": "Markdown"
    },
    "platform": "AtCoder",
    "limit": {
      "time_limit": 2000,
      "memory_limit": 262144
    },
    "difficulty": "None",
    "is_remote": true,
    "is_sync": true,
    "sync_url": null,
    "sign": "abc329_b"
  },
  "statements": [
    {
      "statement_type": "Markdown",
      "content": "You are given $N$ integers $A_1, A_2, \\ldots, A_N$. Find the largest among those integers that are not the largest.\nThe constraints of this problem guarantee that the answer exists.\n\n## Constraints\n\n*...",
      "is_translate": false,
      "language": "English"
    }
  ]
}
Full JSON Raw Segments