Duplicate Element Detection

Time limit: 5000ms
Memory limit: 256mb

Description:
Check whether there exists duplicate elements in an array

Input:
The first line is the length of the array which is no more than 1000000; The second line is the array needed to be checked. The array elements are integers between 0 and 1000000. They are separated by a space. The input array may not be sorted.

Output:
print 'Y' if duplicate elements exist; Otherwise, print 'N'.

Sample input:
5
1 2 2 4 3

Sample output:
Y

Hint:
You may need to use malloc function to generate the array. Supposed the length of the array is N,
#include <stdlib.h>
int* arr=(int*)malloc(sizeof(int)*N);
Submit