0
1
mirror of https://git.sb/baoshuo/OI-codes.git synced 2024-11-27 20:36:28 +00:00
OI-codes/NFLSOJ/13356/samples/chk.cpp

27 lines
886 B (Stored with Git LFS)
C++

#include "testlib.h"
#include <bits/stdc++.h>
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.");
}