10865 - Brownie Points

Problem A: Brownie Points I

Stan and Ollie play the game of Odd Brownie Points. Some browniepoints are located in the plane, at integer coordinates. Stan playsfirst and places a vertical line in the plane. The line must gothrough a brownie point and may cross many (with the samex-coordinate). Then Ollie places a horizontal line that must crossa brownie point already crossed by the vertical line.

Those lines divide the plane into four quadrants. The quadrantcontaining points with arbitrarily large positive coordinates is thetop-right quadrant.

The players score according to the number of brownie points in thequadrants. If a brownie point is crossed by a line, it doesn'tcount. Stan gets a point for each (uncrossed) brownie point in thetop-right and bottom-left quadrants. Ollie gets a point for each(uncrossed) brownie point in the top-left and bottom-right quadrants.

Your task is to compute the scores of Stan and Ollie given the pointthrough which they draw their lines.

Input contains a number of test cases. The data of each test caseappear on a sequence of input lines. The first line of each test casecontains a positive odd integer1 < n < 200000 which is the numberof brownie points. Each of the following n lines containstwo integers, the horizontal (x) and vertical (y)coordinates of a brownie point. No two brownie points occupy the sameplace. The input ends with a line containing 0 (instead of then of a test).

For each test case of input, print a line with two numbers separatedby a single space. The first number is Stan's score, the second is the score of Ollie when their lines cross the point whose coordinatesare given at the center of the input sequence of points for this case.

Sample input

11
3 2
3 3
3 4
3 6
2 -2
1 -3
0 0
-3 -3
-3 -2
-3 -4
3 -7
0

Output for sample input

6 3
#include<stdio.h>
int main(){
	int a[200005][2],x,y,i,n;
	while(scanf("%d",&n)&n)
	{
		for(i=0;i<n;i++)
			scanf("%d%d",&a[i][0],&a[i][1]);
		x=a[n/2][0];y=a[n/2][1];
		int b=0,c=0;
		for(i=0;i<n;i++)
			if ((a[i][0]<x&&a[i][1]<y)||(a[i][0]>x&&a[i][1]>y)) b++;
			else if((a[i][0]>x&&a[i][1]<y)||(a[i][0]<x&&a[i][1]>y)) c++;
		printf("%d %d\n",b,c);
	}
	return 0;
}

Brownie 是一个 Python 框架和开发工具,旨在简化以太坊基础设施的开发和部署。它使用了许多现有的 Python 库,如 Web3py 和 Solidity 来为以太坊开发提供一个友好的环境。 下面是一些 Brownie 工具的详细介绍: 1. 命令行界面 (CLI):Brownie 提供了一个命令行界面,可以方便地管理和部署以太坊智能合约。CLI 支持 Solidity 编译、测试、部署和交互式调试以及其他常见的任务。 2. 项目管理器:Brownie 提供一个项目管理器,可以帮助您组织和管理多个智能合约项目。项目管理器可以自动创建项目结构,包括测试和部署文件夹,并为您的项目创建默认的配置文件。 3. 测试工具:Brownie 提供一组测试工具,包括自动化测试框架和测试覆盖率分析工具。测试工具可以帮助您确保您的智能合约代码质量,并且可以帮助您发现潜在的漏洞和安全问题。 4. 部署工具:Brownie 提供了一组部署工具,可以帮助您部署和管理以太坊智能合约。部署工具可以自动化合约部署,并且可以与常见的以太坊网络(如测试网络和主网络)进行交互。 5. 交互式环境:Brownie 提供一个交互式环境,可以让您方便地与以太坊网络进行交互。您可以使用交互式环境来测试和调试智能合约代码,也可以使用它来执行常见的以太坊任务,如查询余额和交易状态。 总之,如果您正在开发以太坊智能合约,那么 Brownie 工具可以帮助您更轻松地管理和部署您的项目,并提供一组有用的工具来确保您的代码质量和安全性。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值