I am getting RuntimeError for Hidden data sets for the following code:-

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintStream;
import java.util.StringTokenizer;
 class Solution {
        private final static String CORRECT = "CORRECT";
        private final static String WRONG = "WRONG_ANSWER";
        private final static String BIG = "TOO_BIG";
        private final static String SMALL = "TOO_SMALL";
        /**
         * @param args
         * @throws IOException
         * @throws NumberFormatException
         */
        public static void main(String[] args) throws NumberFormatException, 
IOException {
                // TODO Auto-generated method stub

                BufferedReader br = new BufferedReader(new 
InputStreamReader(System.in));
                int T = Integer.parseInt(br.readLine());
                for (int i = 0; i < T; i++) {
                        StringTokenizer st = new StringTokenizer(br.readLine(), 
" ");
                        long a = Long.parseLong(st.nextToken());
                        long b = Long.parseLong(st.nextToken());
                        int N = Integer.parseInt(br.readLine());
                        // pw.println(b);
                        System.out.println(b);
                        // System.out.flush();
                        String result = br.readLine();
                        if (CORRECT.equalsIgnoreCase(result)) {
                                continue;
                        } else {
                                int count = 1;
                                boolean foundAnswer = false;
                                boolean foundWA = false;
                                while (count < N) {
                                        long mid = ((a + b) / 2);
                                        // pw.println(mid);
                                        System.out.println(mid);
                                        count++;
                                        result = br.readLine();
                                        switch (result) {
                                        case BIG:
                                                b = mid;
                                                break;
                                        case CORRECT:
                                                foundAnswer = true;
                                                break;
                                        case SMALL:
                                                a = mid;
                                                break;
                                        case WRONG:
                                                foundWA = true;
                                                break;

                                        }

                                        if (foundAnswer)
                                                break;
                                        if (foundWA)
                                                break;
                                }
                        }
                }
        }

}

-- 
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 post to this group, send email to google-code@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/google-code/2a5a91a8-bbf8-4ede-afa3-6cc4335f43a8%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to