/* vim: set ts=4 sts=4 sw=4 si foldmethod=marker: */ // {{{ stock programming challenge garbage // IO #include #include #include #include // Utility #include #include #include #include #include // Data structures #include //#include #include //#include //#include //#include // Utility typedefs // I want easy access to STL and things like hash_map using namespace std; //using namespace std::tr1; using namespace __gnu_cxx; // Needed for hash_map //namespace __gnu_cxx //{ // template<> struct hash // { // size_t operator()(const std::string& x) const // { // return hash()(x.c_str()); // } // }; //} // }}} typedef vector vs; int main() { long problem(1); while (!cin.eof()) { long solutionLines; cin >> solutionLines; if (!solutionLines) break; cout << "Run #" << problem++ << ": "; cin.ignore(1000, '\n'); string line; vector solution; while (solutionLines--) { getline(cin, line); solution.push_back(line); } long trialLines; cin >> trialLines; cin.ignore(1000, '\n'); vector trial; while (trialLines--) { getline(cin, line); trial.push_back(line); } if (trial.size() == solution.size()) { bool same(true); for (vs::const_iterator i(solution.begin()), j(trial.begin()), ie(solution.end()); i != ie; ++i, ++j) { if (*i != *j) { same = false; break; } } if (same) { cout << "Accepted" << endl; continue; } } vector solnums, trialnums; for (vs::const_iterator i(solution.begin()), ie(solution.end()); i != ie; ++i) for (string::const_iterator j((*i).begin()), je((*i).end()); j != je; ++j) if (*j >= '0' && *j <= '9') solnums.push_back(*j); bool match(true); for (vs::const_iterator i(trial.begin()), ie(trial.end()); match && i != ie; ++i) for (string::const_iterator j((*i).begin()), je((*i).end()); match && j != je; ++j) if (*j >= '0' && *j <= '9') trialnums.push_back(*j); if (trialnums.size() == solnums.size()) { for (vector::const_iterator c(solnums.begin()), ce(solnums.end()), d(trialnums.begin()); c != ce; ++c, ++d) if (*c != *d) { match = false; break; } if (match) { cout << "Presentation Error" << endl; continue; } } cout << "Wrong Answer" << endl; } return 0; }