Created
February 20, 2017 15:52
-
-
Save aswanthkoleri/7a523fb687be5f27466cead06b8d5cf3 to your computer and use it in GitHub Desktop.
BDYFRND
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include<bits/stdc++.h> | |
#include<map> | |
using namespace std; | |
int main() | |
{ | |
int n,i,t; | |
long long int x; | |
map <long long int,int > m; | |
scanf("%d",&t); | |
while(t--) | |
{ | |
scanf("%d",&n); | |
for(i=0;i<n;i++) | |
{ | |
cin>>x; | |
m[x]++; | |
if(m[x]>1) | |
{ | |
printf("YES\n"); | |
} | |
else | |
{ | |
printf("NO\n"); | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Description
Buddy is standing at the door of his classroom. Initially class is empty. There are N students to come. At every instant, a student enters the class and wishes to be seated with a student who has exactly the same number of candies. For each student, Buddy shouts YES if such a student is found, NO otherwise.
Input Format
First line contains an integer T denoting number of test cases.
Next line contains an integer N denoting number of students.
Second line of each test case contains N integers separated by space where Ai number denotes number of candies ith student is having.
Output Format
For each student print YES or NO in new line.
Constraints
1 ≤ T ≤ 105
1 ≤ N ≤ 105
1 ≤ Sum of N ≤ 105
1 ≤ Ai ≤ 1018
Sample Input
1
5
3 2 9 11 2
Sample Output
NO
NO
NO
NO
YES
I used this code in terminal and compiled it .its working propeerly but still the online compiler shows me error. why ?