提供本题SPJ
查看原帖
提供本题SPJ
39863
引领天下魔酸楼主2020/11/30 19:36

不太清楚答案的n,m的范围,于是开到了5000*5000,应该够用?

code:

#include<bits/stdc++.h>
#include"testlib.h"
using namespace std;
int cnt[5000][2],u,v,tot,f[5000][5000];
int main(int argc,char* argv[]){
	registerTestlibCmd(argc,argv);
	int ansm=ans.readInt(),ansn=ans.readInt(),m=ouf.readInt(),n=ouf.readInt(),a=inf.readInt(),b=inf.readInt(),c=inf.readInt(),d=inf.readInt();
	if(ansm+ansn<m+n)quitf(_wa,"Your answer is too large:the answer is %d,your answer is %d.",ansm+ansn,m+n);
	while(!ouf.eof()){
		tot++;
		u=ouf.readInt(),v=ouf.readInt();ouf.readEoln();
		if(f[u][v])quitf(_wa,"Your answer is wrong:the pair of friend numbered %d between %d and %d is repetitive.It was first appeared as #%d.",tot,u,v,f[u][v]);
		f[u][v]=tot;
		cnt[v][u>m]++,cnt[u][v>m]++;
	}
	for(register int i=1;i<=m;i++)if(cnt[i][0]^a||cnt[i][1]^b)quitf(_wa,"Your answer is wrong:the girl numbered %d doesn't have exactly %d girlfriends and %d boyfriends.",i,a,b);
	for(register int i=m+1;i<=m+n;i++)if(cnt[i][0]^c||cnt[i][1]^d)quitf(_wa,"Your answer is wrong:the boy numbered %d doesn't have exactly %d girlfriends and %d boyfriends.",i,c,d);
	quitf(_ok,"Your answer is correct!The answer is %d.",min(ansn+ansm,n+m));
	return 0;
}
2020/11/30 19:36
加载中...