2025 睿抗 RC-u3 点格棋

#include <bits/stdc++.h>
using namespace std;
const int N=1e5+10;
typedef long long ll;
int n,m,t;
struct node
{
	int a,b,c,d;
	bool operator<(const node&y)const
	{
		if(a!=y.a) return a<y.a;
		if(b!=y.b) return b<y.b;
		if(c!=y.c) return c<y.c;
	 	return d<y.d;
	}
}a[N];

map<node,int>mp;
int check(int lx,int x1,int y1,int x2,int y2)
{
	int res=0;
	//-
	if(lx==0)
	{
		int dx=x1-1;
		if(mp.count({dx,y1,dx,y2})&&mp.count({dx,y1,x1,y1})&&mp.count({dx,y2,x2,y2}))
		{
			res++;
		}
		dx=x1+1;
		if(mp.count({dx,y1,dx,y2})&&mp.count({dx,y1,x1,y1})&&mp.count({dx,y2,x2,y2}))
		{
			res++;
		}
	}
	else
	{
		int dy=y1-1;
		if(mp.count({x1,dy,x2,dy})&&mp.count({x1,dy,x1,y2})&&mp.count({x2,dy,x2,y2}))
        {
            res++;
        }
		dy=y1+1;
		if(mp.count({x1,dy,x2,dy})&&mp.count({x1,dy,x1,y2})&&mp.count({x2,dy,x2,y2}))
        {
            res++;
        }

	}
	return res;
}
int main()
{
	cin>>n>>m>>t;
	vector<int>v;
	int cnt1=0,cnt2=0;
	int op=0;
	for(int i=1;i<=t;i++)
	{
		int s,x1,x2,y1,y2;
		cin>>s>>x1>>y1>>x2>>y2;
		int t1=(x1==x2);
		int t2=(y1==y2);
		int mm=max(abs(x1-x2),abs(y1-y2));

		if(mp.count({x1,y1,x2,y2})||mm>1||t1+t2!=1||s!=op||x1<1||x1>n||x2<1||x2>n||y1<1||y1>m||y2<1||y2>m)
		{
			v.push_back(i);
			continue;
		}
		int lx=0;//-
		if(y1==y2) lx=1;//|
		int val=check(lx,x1,y1,x2,y2);
		if(val)
		{
			if(op==0) cnt1+=val;
			else cnt2+=val;
		}
		else op^=1;
		mp[{x1,y1,x2,y2}]++;
		mp[{x2,y2,x1,y1}]++;

	}
	if(v.size()==0)
	{
		cout<<"-1"<<endl;
	}else
	{
		bool f=1;
		for(auto u:v)
		{
			if(f==0) cout<<" ";
			cout<<u;
			f=0;
		}
		cout<<endl;
	}
	if(cnt1>cnt2)
	{
		cout<<"0 "<<cnt1;
	}
	else
	{
		cout<<"1 "<<cnt2<<endl;
	}

	return 0;
}

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值