#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;
}
2025 睿抗 RC-u3 点格棋
于 2025-07-24 22:14:50 首次发布

406

被折叠的 条评论
为什么被折叠?



