#include #include #include #include "streamcorr.h" using namespace std; typedef long long ll; typedef vector vi; typedef pair ii; typedef vector vii; void check_case() { ll n; judge_in >> n; vii author_edges; for (ll i = 0; i < n-1; ++i) { ll u, v; if (!(author_out >> u >> v)) report_error("Wrong output format"); author_edges.push_back(ii(min(u,v), max(u,v))); } vii judge_edges; for (ll i = 0; i < n-1; ++i) { ll u, v; if (!(judge_ans >> u >> v)) judge_error("Judge output format incorrect"); judge_edges.push_back(ii(min(u,v), max(u,v))); } sort(author_edges.begin(), author_edges.end()); // I think judge edges will be sorted, but we need not enforce it sort(judge_edges.begin(), judge_edges.end()); if (author_edges != judge_edges) { report_error("Edges output are incorrect"); } else { cerr << "all good" << endl; } } int main(int argc, char **argv) { try { cerr << "enter" << endl; init_io(argc, argv); check_case(); string trash; if (author_out >> trash) { report_error("Trailing output"); } if (judge_ans >> trash) { judge_error("Judge trailing output"); } cerr << "accept" << endl; accept(); } catch (int e) { report_error("Unknown error occurred, giving verdict WA"); return 43; //shouldn't be necessary, but this ensures JE will not happen } }