cf B 蛙了,求调 ╥﹏╥
  • 板块灌水区
  • 楼主Zhang_Wenjie
  • 当前回复7
  • 已保存回复7
  • 发布时间2023/6/30 10:50
  • 上次更新2023/11/3 12:05:31
查看原帖
cf B 蛙了,求调 ╥﹏╥
481621
Zhang_Wenjie楼主2023/6/30 10:50
#include<bits/stdc++.h>
using namespace std;
int t;
struct node
{
	int x, y;
}a, b, c;
 
int count(int & beg, int & end)
{
	return beg - end;
}
 
bool check()
{
    if ((a.x >= b.x && a.x >= c.x && a.y >= b.y && a.y >= c.y) || (a.x <= b.x && a.x <= c.x && a.y <= b.y && a.y <= c.y)) return true;
    return false;
}
 
int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
 
	cin >> t;
	while (t --)
	{
		cin >> a.x >> a.y >> b.x >> b.y >> c.x >> c.y;
		int lbx = count(a.x, b.x);
		int lby = count(a.y, b.y);
		int lcx = count(a.x, c.x);
		int lcy = count(a.y, c.y);
		int ans = 0;
		bool ikun = false, IKUN = false;
		bool ngm = false, NGM = false;
		if ((lbx ^ lcx) < 0) 
		{
			ans += 1;
			ngm = true;
		}
		else 
		{
			ans += min(abs(lbx), abs(lcx));
			if (check()) ikun = true;
		}
		if ((lby ^ lcy) < 0) 
		{
			ans += 1;
			NGM = true;
		}
		else 
		{
			ans += min(abs(lby), abs(lcy));
			if (check()) IKUN = true;
		}
		if (ikun && IKUN) ans ++;
		if (ngm && NGM) ans --;
		cout << ans << endl;	
	}
 
	return 0;
}
2023/6/30 10:50
加载中...