I tried to solve this problem but running the interactive_runner locally does 
not respond. Online submission gave TLE. I called the runner in the following 
way:
python interactive_runner.py python testing_tool.py -- ./a.out

Here is my code:

#include <stdio.h>
#include <string>
#include <vector>
using namespace std;

int id(char u) {
    return (int) (u - 'A'); 
}

char tag(int i) {
    return (char) (i + 'A');
}

vector<int> a;
vector<vector<int> > b;
vector<int> c;

int main() {
    int t, f;
    scanf("%d %d", &t, &f);

    for (int ca = 1; ca <= t; ca ++) {
        
        char u;
        
        a = vector<int> (5, 0);
        b = vector<vector<int> > (5);

        string ans = "";

        for (int i = 1; i <= 595; i ++) {
            printf("%d", i);
            fflush(stdout);
            scanf("%c ", &u);
            a[id(u)] ++;
            b[id(u)].push_back(i);
        }

        int p[] = {19, 5, 1};

        for (int pi = 0; pi < 3; pi ++) {
            int cur = p[pi];

            int nid;

            for (int i = 0;  i < 5; i ++) {
                if (a[i] == cur) {
                    ans += tag(i);
                    nid = i;
                    break;
                }
            }

            c = vector<int> (b[nid].begin(), b[nid].end());
            a.clear();
            a = vector<int> (5, 0);
            b.clear();
            b = vector<vector<int> > (5);

            for (auto x: c) {
                int i = x + 1;
                printf("%d", i);
                fflush(stdout);
                scanf("%c ", &u);
                a[id(u)] ++;
                b[id(u)].push_back(i);
            }
        }

        for (int i = 0 ;  i < 5; i ++) {
            if (a[i] == 1) {
                printf("%d", b[i][0]);
                fflush(stdout);
                scanf("%c ", &u);
                ans += u;
                ans += tag(i);
                break;
            }
        }
        

        printf("%s", ans.c_str());
        fflush(stdout);

        scanf("%c ", &u);
        if (u == 'N') break;

    }

    return 0;
}

-- 
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 [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/google-code/ffc16900-3675-4e63-9c01-691295b813eb%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to