Unfortunately, I'm not sure what's the issue with my code for this problem. 
I'm just a newbie who competed in Code Jam for the first time, even though 
I do have some experience with Java.
For your reference, here's my code:

//Template for Solution submissions
import java.util.*;
import java.io.*;
public class Solution 
{
public static void main (String [] args)
{
Scanner input = new Scanner(new BufferedReader(new 
InputStreamReader(System.in)));
int t = input.nextInt();
for(int i = 1; i <= t; i++)
{
int n = input.nextInt();
int[][] activities = new int[n][2];
for(int j = 0; j < n; j++)
{
int[] timeVals = new int[2];
for(int p = 0; p < timeVals.length; p++)
{
timeVals[p] = input.nextInt();
}
activities[j] = timeVals;
}
String y = "";
String[] personResp = new String[n];
//Determine whether y is impossible or not
personResp[0] = "C";
int b = 1;
while(b < activities.length && !(y.equals("IMPOSSIBLE")))
{ 
HashSet<String> notResp = new HashSet<String>();
int bStart = activities[b][0];
int bEnd = activities[b][1];
int c = b-1;
while(c >= 0)
{
int cStart = activities[c][0];
int cEnd = activities[c][1];
if((cEnd > bStart && cStart < bEnd) || (bEnd > cStart && bStart < cEnd))
{
notResp.add(personResp[c]);
}
c--;
}
if(notResp.contains("C") && notResp.contains("J"))
{
y = "IMPOSSIBLE"; 
}
else if(notResp.contains("C"))
{
personResp[b] = "J";
}
else
{
personResp[b] = "C";
}
b++;
}
if(!(y.equals("IMPOSSIBLE")))
{
for(String str: personResp)
{
y += str;
}
}
System.out.println("Case #" + i + ": " + y);
}
}
}

Could anyone please explain what is wrong?

-- 
You received this message because you are subscribed to the Google Groups 
"Google Code Jam" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-code+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/google-code/494d72ee-7bf6-48b9-95d6-cf9223fdf324%40googlegroups.com.

Reply via email to