Maximum Difference

AtCoder
IDabc102_b
Time2000ms
Memory256MB
Difficulty
You are given an integer sequence $A$ of length $N$. Find the maximum absolute difference of two elements (with different indices) in $A$. ## Constraints * $2 \leq N \leq 100$ * $1 \leq A_i \leq 10^9$ * All values in input are integers. ## Input Input is given from Standard Input in the following format: $N$ $A_1$ $A_2$ $...$ $A_N$ [samples]
Samples
Input #1
4
1 4 6 3
Output #1
5

The maximum absolute difference of two elements is $A_3-A_1=6-1=5$.
Input #2
2
1000000000 1
Output #2
999999999
Input #3
5
1 1 1 1 1
Output #3
0
API Response (JSON)
{
  "problem": {
    "name": "Maximum Difference",
    "description": {
      "content": "You are given an integer sequence $A$ of length $N$. Find the maximum absolute difference of two elements (with different indices) in $A$.",
      "description_type": "Markdown"
    },
    "platform": "AtCoder",
    "limit": {
      "time_limit": 2000,
      "memory_limit": 262144
    },
    "difficulty": "None",
    "is_remote": true,
    "is_sync": true,
    "sync_url": null,
    "sign": "abc102_b"
  },
  "statements": [
    {
      "statement_type": "Markdown",
      "content": "You are given an integer sequence $A$ of length $N$. Find the maximum absolute difference of two elements (with different indices) in $A$.\n\n## Constraints\n\n*   $2 \\leq N \\leq 100$\n*   $1 \\leq A_i \\leq...",
      "is_translate": false,
      "language": "English"
    }
  ]
}
Full JSON Raw Segments