0
1
mirror of https://git.sb/baoshuo/OI-codes.git synced 2024-11-13 07:18:48 +00:00
OI-codes/S2OJ/1809/data/chk.cpp

98 lines
1.6 KiB (Stored with Git LFS)
C++

#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <math.h>
#include <time.h>
#include <vector>
#include <bitset>
#include <queue>
#include <set>
#include <map>
#include<algorithm>
#include <iostream>
#include "testlib.h"
using namespace std;
//FILE *fin, *fout, *fstdout, *freport;
void Done(int report)
{
//fprintf(freport, "%d\n", report);
// quitp(ceil(100.0 * p / a) / 100, "haha");
quitp(ceil(100.0*report/10)/100,"ok");
//fclose(freport);
exit(0);
}
const int N=100005;
int flag=10,n,m,Ansm,fa[N],vis[N],col[N],w[N],Ans[N];
void check()
{
//fscanf(fin,"%d",&n);
n = inf.readInt();
for(int i=1;i<=n;i++)
vis[i]=1;
for(int i=1;i<=n;i++)
{
//fscanf(fin,"%d",&fa[i]);
fa[i]=inf.readInt();
vis[fa[i]]=0;
}
for(int i=1;i<=n;i++)
//fscanf(fin,"%d",&col[i]);
col[i] = inf.readInt();
//fscanf(fout,"%d",&m);
m = ouf.readInt();
//fscanf(fstdout,"%d",&Ansm);
Ansm = ans.readInt();
if(m>n)
Done(0);
if(m!=-1&&Ansm==-1)
Done(0);
if(m==-1&&Ansm!=-1)
Done(0);
for(int i=1;i<=m;i++)
{
// fscanf(fout,"%d",&w[i]);
w[i] = ouf.readInt();
/*if(w[i]<w[i-1])
Done(0);
if(!vis[w[i]])
Done(0);*/
}
for(int i=1;i<=Ansm;i++)
// fscanf(fstdout,"%d",&Ans[i]);
Ans[i] = ans.readInt();
if(m!=Ansm||flag==5)
{
flag=5;return;
}
for(int i=1;i<=Ansm;i++)
if(w[i]!=Ans[i])
{
flag=5;return;
}
}
int main(int argc, char* argv[])
{
registerTestlibCmd(argc,argv);
//inf fin = fopen(argv[1], "r");
//ouf fout = fopen(argv[2], "r");
//ans fstdout = fopen(argv[3], "r");
// freport = fopen(argv[5], "w");
int t = inf.readInt();
//fscanf(fin,"%d",&t);
while(t--)
check();
Done(flag);
}