def maxarea(height):
    left = 0
    right = len(height) - 1  # Initialize right pointer
    max_water = 0  # To store the maximum water volume
    
    while left < right:
        # Calculate the current water volume
        width = right - left
        current_height = min(height[left], height[right])
        current_water = width * current_height
        
        # Update max water if the current water is greater
        max_water = max(max_water, current_water)
        
        # Move the pointer pointing to the shorter line inward
        if height[left] < height[right]:
            left += 1
        else:
            right -= 1
    
    return max_water

# Example usage
height = [1, 8, 6, 2, 5, 4, 8, 3, 6]
print(maxarea(height))  # Output: 49
