#include "testlib.h" #include using namespace std; string S, T, f, g; int main(int argc, char* argv[]) { registerTestlibCmd(argc, argv); S = inf.readWord(), T = inf.readWord(); if (S.length() != T.length()) ans.quitf(_wa, "Wrong data."); int n = S.length(); f = ans.readWord("YES|NO"), g = ouf.readWord("YES|NO"); if (f != g) { if (f == "YES") quitf(_wa, "Participant did not find the solution, while jury did."); } if (g == "NO") quitf(_ok, "OK."); int m = ouf.readInt(0, 8 * n); while (m--) { int l = ouf.readInt(1, n), r = ouf.readInt(l, n); int x = count(S.begin() + l - 1, S.begin() + r, '1') & 1; if (x) quitf(_wa, "Wrong solution."); reverse(S.begin() + l - 1, S.begin() + r); } if (S != T) quitf(_wa, "Wrong solution."); quitf(_ok, "OK."); }