codeforces longest zigzag sequence