 # Dancing Pokemon(CJ01) Editorial

Can someone provide me with editorial of this problem

The simplest solution would be by using STL-MAPS. We just have to check if the number has occurred before or not.

Create a map with an integer and a boolean value.
Just insert into the map all the poke-ids with boolean value 1(true).

Next just check if the next pokemon is already in the map.
If YES, output “YES”, else output “NO” and insert it into the map with true.

Complexity:- O(N.Log(N))

Other solution could be simply to use binary trees.

you can use set to do this question see my solution here link texthttps://www.codechef.com/viewsolution/11219412

Hello chefs I’m new to codechef and also the beginner to the programming My solution to this problem is

``````
import java.util.*;
public class Main {
public static void main(String args[]) {
ArrayList <Integer> partyattendersid;
partyattendersid = new ArrayList <Integer>();
Scanner scanner = new Scanner(System.in);
int T;
T = scanner.nextInt();
for(int i=0;i<T;i++) {
int N,Q,id;
N = scanner.nextInt();
Q = scanner.nextInt();
for(int j=0;j<N;j++) {
id = scanner.nextInt();
if(partyattendersid.indexOf(id) != -1);
}
int qid[] = new int[Q];
for(int j=0;j<Q;j++)
qid[j] = scanner.nextInt();
for(int j=0;j<Q;j++) {
if(partyattendersid.indexOf(qid[j]) == -1) {
System.out.println("NO");
I have tested my code in my system I’m getting the correct answer, but I submit to codechef I’m getting the wrong answer please help me… Any error in my code??? Thanks in advance 