#CODEFORCESP7529. Alice, Bob and Chocolate
Alice, Bob and Chocolate
描述
Alice 和 Bob 喜欢玩游戏。现在他们准备开始一场新的游戏。他们在一条线上放置了n块巧克力。Alice 从左到右开始吃巧克力,Bob从右到左。每个巧克力的消费时间都已知(Alice 和 Bob 同样的速度吃掉它们)。当玩家吃掉了一块巧克力,他会立即开始下一块。不允许同时吃两块巧克力,不允许中途停下没有吃完,不允许放慢速度。如果两个玩家同时开始吃同一块巧克力,Bob会把它让给Alice,作为一个真正的绅士。
每个玩家吃掉多少块巧克力?
第一行包含一个整数n(1 ≤ n ≤ 105) - 桌子上有的巧克力棒数量。第二行包含一个序列t1, t2, ..., tn(1 ≤ ti ≤ 1000),其中ti表示消费i号巧克力所需的时间(按从左到右的顺序)以秒为单位。
打印两个数字a和b,其中a是Alice消费的巧克力数量,b是Bob消费的巧克力数量。
Alice and Bob like games. And now they are ready to start a new game. They have placed n 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?
The first line contains one integer n (1 ≤ n ≤ 105) — the amount of bars on the table. The second line contains a sequence t1, t2, ..., tn (1 ≤ ti ≤ 1000), where ti is the time (in seconds) needed to consume the i-th bar (in the order from left to right).
Print two numbers a and b, where a is the amount of bars consumed by Alice, and b is the amount of bars consumed by Bob.
Input
The first line contains one integer n (1 ≤ n ≤ 105) — the amount of bars on the table. The second line contains a sequence t1, t2, ..., tn (1 ≤ ti ≤ 1000), where ti is the time (in seconds) needed to consume the i-th bar (in the order from left to right).
Output
Print two numbers a and b, where a is the amount of bars consumed by Alice, and b is the amount of bars consumed by Bob.
Samples
5
2 9 8 2 7
2 3