Programming Geek
Rated 4.1/5 based on 446 reviews

CodeVita Season IV Round 1 : Accico Equi Pairs

Problem : Accico Equi Pairs

Ron Wesley has been bit by a three headed snake and Harry Potter is searching for a potion. The Witch promises to tell the ingredients of the medicine if Harry can find equi pair of an array. Listen to the conversation between Harry The witch to know more about equi pairs.


The Witch : To find the equi pair, you must know how to find the slices first.
Harry         : What is a slice?
The Witch : If Z is an array with N elements, a slice of indices (X, Y) is Z[X] + Z[X+1]...Z[Y]
Harry         : How can I use it to find equi pair?
The Witch : (a, b) is an equi pair if slice of (0, a-1) = slice of (a+1, b-1) = slice of (b+1, N-1) and b>a+1 and size of array > 4
Input Format:

An array of N integers delimited by white space
Output Format:

Print equi pair in first line in the format { a,b }
Print slices in the format { 0,a-1 }, { a+1,b-1 }, { b+1,N-1 }


Print "Array does not contain any equi pair" if there are no equi pairs in the array
Zi >= 0 and 1<= i <=N
size of array (N) > 4
b > (a+1) 
Sample Input and Output



8 3 5 2 10 6 7 9 5 2

Indices which form equi pair { 3,6 }
Slices are { 0,2 },{ 4,5 },{ 7,9 }


6 2 6 2 3 3 1 9

Array does not contain any equi pair


Please do not use package and namespace in your code. For object oriented languages your code should be written in one class.

Participants submitting solutions in C language should not use functions from / as these files do not exist in gcc

For C and C++, return type of main() function should be int.