{"id":"75475223-3ecb-433b-bddf-467fe101419c","name":"Cats And Tree","description":"<a href=\"https://www.codechef.com/problems/CATS\">https://www.codechef.com/problems/CATS</a>","inputFormat":".","outputFormat":".","constraints":".","sampleCode":{"cpp":{"code":""},"java":{"code":"import java.io.*;\r\nimport java.util.*;\r\n\r\npublic class Main {\r\n static BufferedReader in = new BufferedReader(new InputStreamReader(System.in));\r\n static PrintWriter out = new PrintWriter(System.out);\r\n /*\r\n use in for reading input\r\n use out for printing output\r\n */\r\n\r\n public static void main(String[] args) throws IOException {\r\n\r\n // write your code here.\r\n\r\n\r\n\r\n out.close();\r\n }\r\n}\r\n"},"ruby":{"code":""},"python":{"code":""},"javascript":{"code":""}},"points":10,"difficulty":"hard","sampleInput":"10\r\n0 1 2 3 3 1 6 6 6 1\r\n5 6 3 4 2 1 7 8 9 10","sampleOutput":"4\r\n1\r\n2\r\n2\r\n0\r\n0\r\n1\r\n1\r\n1\r\n1","questionVideo":"","hints":[],"associated":[],"solutionSeen":false,"tags":[],"meta":{"path":[{"id":0,"name":"home"},{"id":"0c54b191-7b99-4f2c-acb3-e7f2ec748b2a","name":"Data Structures and Algorithms","slug":"data-structures-and-algorithms","type":0},{"id":"ebd4bd7d-3745-4e3b-9603-da905237841b","name":"Binary Lifting For Experts","slug":"binary-lifting-for-experts-971","type":0},{"id":"af6ecae1-53a9-4255-af7e-150e6b01dd94","name":"Cats And Tree","slug":"cats-and-tree","type":1}],"next":{"id":"1e97a56a-756b-4c70-ada0-605fd74618ee","name":"Learning Dishes","type":1,"slug":"learning-dishes"},"prev":{"id":"c3e66693-4622-4eb6-aa76-1d162b164516","name":"Lca - Lowest Common Ancestor","type":1,"slug":"lca-lowest-common-ancestor"}}}

Cats And Tree

<a href="https://www.codechef.com/problems/CATS">https://www.codechef.com/problems/CATS</a>

{"id":"75475223-3ecb-433b-bddf-467fe101419c","name":"Cats And Tree","description":"<a href=\"https://www.codechef.com/problems/CATS\">https://www.codechef.com/problems/CATS</a>","inputFormat":".","outputFormat":".","constraints":".","sampleCode":{"cpp":{"code":""},"java":{"code":"import java.io.*;\r\nimport java.util.*;\r\n\r\npublic class Main {\r\n static BufferedReader in = new BufferedReader(new InputStreamReader(System.in));\r\n static PrintWriter out = new PrintWriter(System.out);\r\n /*\r\n use in for reading input\r\n use out for printing output\r\n */\r\n\r\n public static void main(String[] args) throws IOException {\r\n\r\n // write your code here.\r\n\r\n\r\n\r\n out.close();\r\n }\r\n}\r\n"},"ruby":{"code":""},"python":{"code":""},"javascript":{"code":""}},"points":10,"difficulty":"hard","sampleInput":"10\r\n0 1 2 3 3 1 6 6 6 1\r\n5 6 3 4 2 1 7 8 9 10","sampleOutput":"4\r\n1\r\n2\r\n2\r\n0\r\n0\r\n1\r\n1\r\n1\r\n1","questionVideo":"","hints":[],"associated":[],"solutionSeen":false,"tags":[],"meta":{"path":[{"id":0,"name":"home"},{"id":"0c54b191-7b99-4f2c-acb3-e7f2ec748b2a","name":"Data Structures and Algorithms","slug":"data-structures-and-algorithms","type":0},{"id":"ebd4bd7d-3745-4e3b-9603-da905237841b","name":"Binary Lifting For Experts","slug":"binary-lifting-for-experts-971","type":0},{"id":"af6ecae1-53a9-4255-af7e-150e6b01dd94","name":"Cats And Tree","slug":"cats-and-tree","type":1}],"next":{"id":"1e97a56a-756b-4c70-ada0-605fd74618ee","name":"Learning Dishes","type":1,"slug":"learning-dishes"},"prev":{"id":"c3e66693-4622-4eb6-aa76-1d162b164516","name":"Lca - Lowest Common Ancestor","type":1,"slug":"lca-lowest-common-ancestor"}}}
plane

Editor


Loading...

Cats And Tree

hard

https://www.codechef.com/problems/CATS

Constraints

.

Format

Input

.

Output

.

Example

Sample Input

10 0 1 2 3 3 1 6 6 6 1 5 6 3 4 2 1 7 8 9 10

Sample Output

4 1 2 2 0 0 1 1 1 1

Discussions

Show Discussion

Related Resources

related resources

Turning Off Zen Mode