Problem C
Critical
Wave
Input: standard input
Output: standard output
Time Limit: 10 seconds
The task is simple. Through some critical points in 2D, you are to draw a wave like curve. Your goal is to include as many points as possible.
Two consecutive points on the
curve should have a difference of 2 in their y coordinate
There will be no more than 222 test cases. Each test case starts with an integer N, the number of points in the test case. In the next N lines, there will be N pair of integers giving the x and y coordinate of the points. There will be no more than 1000 points in each test case. All coordinates are integers -- they'd fit in an signed 2 byte integer data type.
Output
For each test case print a number -- the maximum number of critical points that can be included in a curve drawn from the given points.
10
0 1
1 0
1 -1
2 -2
3 1
3 -1
3 -2
4 1
4 -1
5
–1
10
0 1
1 0
1 -1
2 -2
3 1
3 -1
3 -2
4 1
4 -1
5 –1
4
4
Problem-setter: Monirul Hasan Tomal
“If you don’t consider your life as a journey you will advance nowhere and life will appear to you as an endless and hopeless track.”