Hi, My solution runs locally on my PC but gives me RE when I submit it online.
Here is the code: #include <bits/stdc++.h> using namespace std; int main() { int t, f; cin >> t >> f; char c; for (int i = 0; i < t; i++) { string abc[120]; for (int o = 0; o < 120; o++) abc[o] = ""; // f = 475; string ans = ""; int A = 0, B = 0, C = 0, D = 0, E = 0; // for (int j = 0; j <= 3; j++) { int a = 0, b = 0, c = 0, d = 0, e = 0; for (int k = 0; k < 119; k++) { // if (!(j == 3 && k == 118)) { cout << ((k * 5) + 1) << endl; string s; cin >> s; abc[k + 1].append(1, s[0]); if (s[0] == 'A') a++; else if (s[0] == 'B') b++; else if (s[0] == 'C') c++; else if (s[0] == 'D') d++; else if (s[0] == 'E') e++; // else // cout << "error" << endl; // } } vector<int> w; if (a != 0) w.push_back(a); if (b != 0) w.push_back(b); if (c != 0) w.push_back(c); if (d != 0) w.push_back(d); if (e != 0) w.push_back(e); sort(w.begin(), w.end()); if (w[0] == a) { ans.append(1, 'A'); A = 1; } else if (w[0] == b) { ans.append(1, 'B'); B = 1; } else if (w[0] == c) { ans.append(1, 'C'); C = 1; } else if (w[0] == d) { ans.append(1, 'D'); D = 1; } else if (w[0] == e) { ans.append(1, 'E'); E = 1; } a = 0, b = 0, c = 0, d = 0, e = 0; for (int h = 1; h < 120; h++) { // 24 times if (abc[h][0] == ans[0]) { cout << (((h - 1) * 5) + 2) << endl; string s; cin >> s; abc[h].append(1, s[0]); if (s[0] == 'A') a++; else if (s[0] == 'B') b++; else if (s[0] == 'C') c++; else if (s[0] == 'D') d++; else if (s[0] == 'E') e++; // else // cout << "error" << endl; } } vector<int> w1; if (a != 0) w1.push_back(a); if (b != 0) w1.push_back(b); if (c != 0) w1.push_back(c); if (d != 0) w1.push_back(d); if (e != 0) w1.push_back(e); sort(w1.begin(), w1.end()); if (w1[0] == a) { ans.append(1, 'A'); A = 1; } else if (w1[0] == b) { ans.append(1, 'B'); B = 1; } else if (w1[0] == c) { ans.append(1, 'C'); C = 1; } else if (w1[0] == d) { ans.append(1, 'D'); D = 1; } else if (w1[0] == e) { ans.append(1, 'E'); E = 1; } a = 0, b = 0, c = 0, d = 0, e = 0; for (int h = 1; h < 120; h++) { // 6 times if (abc[h].length() == 2) if (abc[h][0] == ans[0] && abc[h][1] == ans[1]) { cout << (((h - 1) * 5) + 3) << endl; string s; cin >> s; abc[h].append(1, s[0]); if (s[0] == 'A') a++; else if (s[0] == 'B') b++; else if (s[0] == 'C') c++; else if (s[0] == 'D') d++; else if (s[0] == 'E') e++; // else // cout << "error" << endl; } } vector<int> w2; if (a != 0) w2.push_back(a); if (b != 0) w2.push_back(b); if (c != 0) w2.push_back(c); if (d != 0) w2.push_back(d); if (e != 0) w2.push_back(e); sort(w2.begin(), w2.end()); if (w2[0] == a) { ans.append(1, 'A'); A = 1; } else if (w2[0] == b) { ans.append(1, 'B'); B = 1; } else if (w2[0] == c) { ans.append(1, 'C'); C = 1; } else if (w2[0] == d) { ans.append(1, 'D'); D = 1; } else if (w2[0] == e) { ans.append(1, 'E'); E = 1; } a = 0, b = 0, c = 0, d = 0, e = 0; for (int h = 1; h < 120; h++) { if (abc[h].length() == 3) if (abc[h][0] == ans[0] && abc[h][1] == ans[1] && abc[h][2] == ans[2]) { cout << (((h - 1) * 5) + 4) << endl; string s; cin >> s; abc[h].append(1, s[0]); if (s[0] == 'A') a++; else if (s[0] == 'B') b++; else if (s[0] == 'C') c++; else if (s[0] == 'D') d++; else if (s[0] == 'E') e++; // else // cout << "error" << endl; } } // vector<int> w3; if (a == 1) { if (B == 0) { ans.append(1, 'B'); B = 1; } else if (C == 0) { ans.append(1, 'C'); C = 1; } else if (D == 0) { ans.append(1, 'D'); D = 1; } else if (E == 0) { ans.append(1, 'E'); E = 1; } } if (b == 1) { if (A == 0) { ans.append(1, 'A'); A = 1; } else if (C == 0) { ans.append(1, 'C'); C = 1; } else if (D == 0) { ans.append(1, 'D'); D = 1; } else if (E == 0) { ans.append(1, 'E'); E = 1; } } if (c == 1) { if (B == 0) { ans.append(1, 'B'); B = 1; } else if (A == 0) { ans.append(1, 'A'); A = 1; } else if (D == 0) { ans.append(1, 'D'); D = 1; } else if (E == 0) { ans.append(1, 'E'); E = 1; } } if (d == 1) { if (B == 0) { ans.append(1, 'B'); B = 1; } else if (C == 0) { ans.append(1, 'C'); C = 1; } else if (A == 0) { ans.append(1, 'A'); A = 1; } else if (E == 0) { ans.append(1, 'E'); E = 1; } } if (e == 1) { if (B == 0) { ans.append(1, 'B'); B = 1; } else if (C == 0) { ans.append(1, 'C'); C = 1; } else if (D == 0) { ans.append(1, 'D'); D = 1; } else if (A == 0) { ans.append(1, 'A'); A = 1; } } // sort(w3.begin(), w3.end()); if (A == 0) ans.append(1, 'A'); else if (B == 0) ans.append(1, 'B'); else if (C == 0) ans.append(1, 'C'); else if (D == 0) ans.append(1, 'D'); else if (E == 0) ans.append(1, 'E'); cout << ans << endl; cin >> c; if (c == 'N') return 0; } 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 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/68a23f50-1939-466c-8041-d0f490c92e75%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.