CF6C.Alice, Bob and Chocolate

普及-

通过率:0%

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

Alice and Bob like games. And now they are ready to start a new game. They have placed nn chocolate bars in a line. Alice starts to eat chocolate bars one by one from left to right, and Bob — from right to left. For each chocololate bar the time, needed for the player to consume it, is known (Alice and Bob eat them with equal speed). When the player consumes a chocolate bar, he immediately starts with another. It is not allowed to eat two chocolate bars at the same time, to leave the bar unfinished and to make pauses. If both players start to eat the same bar simultaneously, Bob leaves it to Alice as a true gentleman.

How many bars each of the players will consume?

n个糖,a从前往后吃,b从后往前吃,每个糖都有吃完需要的时间,每个人在同一时间只能吃一个,吃完某一个后,才能吃下一个,如果两个人同时开始吃同一个,b会让给a,问最后每个人总共吃了多少糖

输入格式

The first line contains one integer nn ( 1<=n<=1051<=n<=10^{5} ) — the amount of bars on the table. The second line contains a sequence t1,t2,...,tnt_{1},t_{2},...,t_{n} ( 1<=ti<=10001<=t_{i}<=1000 ), where tit_{i} is the time (in seconds) needed to consume the ii -th bar (in the order from left to right).

输出格式

Print two numbers aa and bb , where aa is the amount of bars consumed by Alice, and bb is the amount of bars consumed by Bob.

输入输出样例

  • 输入#1

    5
    2 9 8 2 7

    输出#1

    2 3
首页