0% found this document useful (0 votes)
11 views1 page

Prob A

The document describes a programming competition hosted by the University of Science and Technology - The University of Danang in Vietnam. It also provides an easy problem description involving finding the maximum value of an expression involving the absolute value of the differences between elements in an array and indices.

Uploaded by

Sơn Lê
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
11 views1 page

Prob A

The document describes a programming competition hosted by the University of Science and Technology - The University of Danang in Vietnam. It also provides an easy problem description involving finding the maximum value of an expression involving the absolute value of the differences between elements in an array and indices.

Uploaded by

Sơn Lê
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

2018 ACM-ICPC Vietnam Central Provincial Programming Contest

Hosted by University of Science and Technology - The University of Danang

EASY PROBLEM
Michael just learned about Absolute value and its properties. He also thinks mathematics is his
instinct so after school, he usually tries to come up with new problem to practice and sharpen his
skill. Today, after solving all homework, to kill his boredom, he finds a very strange problem:
Given an array of N integers, X1, X2, … XN. Find the maximum value of:
|Xi – Xj| + |i – j|, for 1 ≤ i, j ≤ N

Input
- The first line is the number N, 2 ≤ N ≤ 1.000.000
- The next line contains N elements of array, |Xi| ≤ 108, for 1 ≤ i ≤ N

Output
Maximum value of the function defined above.

Examples
Standard Input Standard Output
4 12
2 -1 5 9

Explain:
Choose X2 = -1 and X4 = 9.
|-1-9| + |2-4| = 12

You might also like