RT.
#include "testlib.h"
#include <bits/stdc++.h>
using namespace std;
int S[1000050],T[1000050];
bool flg[1000050];
int main(int argc,char* argv[])
{
registerTestlibCmd(argc,argv);
int Tc = inf.readInt();
while(Tc --)
{
int n = inf.readInt();
int m = inf.readInt();
for(int i = 1;i <= n; ++ i)
{
S[i] = inf.readInt();
flg[i] = 0;
}
for(int i = 1;i <= n; ++ i)
T[i] = inf.readInt();
string as = ouf.readString();
while(as[0] != 'Y' && as[0] != 'N') as = ouf.readString();
string st = ans.readString();
while(st[0] != 'Y' && st[0] != 'N') st = ans.readString();
if(st != as)
{
quitf(_wa,"Expected %s, received %s\n",st.c_str(),as.c_str());
return 0;
}
if(st[0] == 'Y')
{
int pos = 1;
for(int i = 1;i <= 3; ++ i)
{
int l = ouf.readInt();int r = ouf.readInt();
if(l > r || l < 0 || r > n)
{
quitf(_wa,"Received [%d,%d]\n",l,r);
return 0;
}
for(int j = l;j <= r;j ++)
{
if(flg[j])
{
quitf(_wa,"Your answer is incorrect.\n");
return 0;
}
flg[j] = 1;
if(T[j] != S[pos ++])
{
quitf(_wa,"Your answer doesn't match S.\n");
return 0;
}
}
}
if(pos != n + 1)
{
quitf(_wa,"Your answer is incorrect.\n");
return 0;
}
}
}
quitf(_ok,"Ok, correct.\n");
return 0;
}