ENG  RUS Timus Online Judge
Online Judge
Problems
Authors
Online contests
Site news
Webboard
Problem set
Submit solution
Judge status
Guide
Register
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

## Discussion of Problem 1010. Discrete Function

If you have WA2
Posted by Andrew Sboev 5 Jul 2012 17:47
1) Maybe, you are reading long long variable with this command :
scanf("%d",&arr[i]);
It is not right. You should do, for example, it with next command
scanf("%I64d",&arr[i]);
2) Maybe, you were confused by statement. You have to choose such two points so line that passing through this points has maximal absolute value of inclination, not just inclination.
3) Maybe, you are doing something like this :
for ( int i = 1 ; i <= n ; ++i ) {
long long d = abs2(arr[i+1] - arr[i]);

if ( d > x ) {
x = d; m1 = i;
}
}
There is a mistake in first line. Right way is
for ( int i = 1 ; i < n ; ++i ) {

It was my biggest mistake, because the problem itself is so simple.
Re: If you have WA2
Posted by kaa..........ai 30 Jun 2013 15:34
Thannnnnnnnnnnnnnnnnk youuuuuuuuuuuuuu verrrrrrrrrrrrry mucccccccccccccch!
Re: If you have WA2
Posted by Lytning 25 Sep 2014 19:42
Thannnnnnnnnnnnnnnnnk youuuuuuuuuuuuuu verrrrrrrrrrrrry mucccccccccccccch!
Re: If you have WA2
Posted by whyno11 2 Sep 2017 15:49
Thanks a lot! The definition of inclination is ambiguous in the problem statement.
Re: If you have WA2
Posted by Myrcella 21 Aug 2018 08:12
Thanks a lot! I have ignored "absolute value" too.
Re: If you have WA2
Posted by STK@fire 27 Aug 2018 11:07
Thannnnnnnnnnnnnnnnnk youuuuuuuuuuuuuu verrrrrrrrrrrrry mucccccccccccccch!
Re: If you have WA2
Posted by abid1729 27 May 2019 21:32
Thannnnnnnnnnnnnnnnnk youuuuuuuuuuuuuu verrrrrrrrrrrrry mucccccccccccccch!