Judge调不出来的自取
查看原帖
Judge调不出来的自取
542698
封禁用户楼主2024/6/21 21:33

从test.in中读取输入,输出到test.out中,将你的程序命名为code.exe

#include<bits/stdc++.h>
using namespace std;
int N,M,K,n,m,k,d[4][2]={0,1,0,-1,1,0,-1,0};
char c[5005][5005];
int main()
{
	cin>>N>>M>>K;
	srand(time(0));
	while(1)
	{
		ofstream out("test.in");
		string ans;
		n=rand()%N+3,m=rand()%M+3,k=rand()%K+3;
		out<<n<<" "<<m<<" "<<k<<endl;
		system("code.exe");
		ifstream in("test.out");
		in>>ans;
		if(ans=="No")
		{
			if(k>n*m||k<n||k%2!=n%2||n%2==1&&m%2==0&&k>=n*m)
			{
				cout<<"AC"<<endl;
				continue;
			}
			else
			{
				cout<<"WA";
				while(1);
			}
		//	while(1);
		}
		if(k>n*m||k<n||k%2!=n%2||n%2==1&&m%2==0&&k>=n*m)
		{
			cout<<"WA"<<endl;
			while(1);
		}
		for(int i=1;i<=n*2+1;i++)for(int j=1;j<=m*2+1;j++)in>>c[i][j];
		int x=2,y=2*m,cnt=2,lastx=1,lasty=2*m;
		while(1)
		{
			int tox=0,toy=0;
			for(int i=0;i<4;i++)
			{
				int dx=x+d[i][0],dy=y+d[i][1];
				if(dx<=1||dx>=2*n+1||dy<=1||dy>=2*m+1||c[dx][dy]=='|'||c[dx][dy]=='-'||x+d[i][0]*2==lastx&&y+d[i][1]*2==lasty)continue;
				if(tox&&toy)
				{
					cout<<"Too many paths on "<<x<<" "<<y<<endl;
					while(1);
				}
				tox=x+d[i][0]*2,toy=y+d[i][1]*2;
			}
			if(!tox||!toy)
			{
				cout<<"No path on "<<x<<" "<<y<<endl;
				while(1);
			}
			lastx=x,lasty=y;
			x=tox,y=toy;
			if(c[x+1][y]=='G')
			{
				if(cnt!=k)
				{
					cout<<"Dis Wrong";
					while(1);
				}
				else
				{
					cout<<"AC"<<endl;
					break;
				//	while(1);
				}
			}
			++cnt;
		}
	}
}
2024/6/21 21:33
加载中...