RE求助
查看原帖
RE求助
158400
晴空一鹤楼主2021/2/17 21:00

除了4个WA其他全RE

求各位大佬帮忙看看

#include<bits/stdc++.h>
using namespace std;
bool a[100001][3];
struct node
{
	int x,y;
	friend bool operator<(node a,node b)
	{
		if(a.x==b.x)
		return a.y<b.y;
		return a.x>b.x;
	}
}t;
priority_queue<node>q;
int main()
{
	int T,n;
    char c;
    cin>>T;
	while(T--)
	{
		cin>>n;
		bool k=1;
		c=getchar();
		for(int j=1;j<=2;j++)
		{
		for(int i=1;i<=n;i++)
		{
			a[i][j]=0;
			c=getchar();
			if(c=='1')
			{
				a[i][j]=1;
				t.x=i,t.y=j;
			    q.push(t);
			}
		}
		c=getchar();
		}
		while(!q.empty())
		{
			t=q.top();
			q.pop();
			if(t.x>1&&a[t.x-1][t.y]==0)
			  a[t.x-1][t.y]=1;
			else
			  if(t.y==1&&a[t.x][2]==0)
			    a[t.x][2]=1;
			  else
			    if(t.y==2&&a[t.x][1]==0)
			      a[t.x][1]=1;
			    else
			      if(t.x<n&&a[t.x+1][t.y]==0)
			        a[t.x+1][t.y]=1;
			      else
			        k=0;
		}
		if(k)
		cout<<"RP"<<endl;
		else
		cout<<"++"<<endl;
	}
}
2021/2/17 21:00
加载中...