#TP0000037. Alice, Bob và những thanh sô-cô-la (Alice, Bob and Chocolate)
Bài tập thuộc lộ trình
Mục lục đề ⌄
Alice, Bob và những thanh sô-cô-la (Alice, Bob and Chocolate)
Alice, Bob and Chocolate
Source: Codeforces
Version: Phuoc Hung OJ Extended
Problem Statement
There are chocolate bars arranged from left to right. Alice eats from the left and Bob from the right. Both start simultaneously, eat at the same speed, never pause, and finish each bar before taking another. Bar takes seconds to eat. Whenever a player finishes, they immediately take the next available bar at their end. If both simultaneously reach the final remaining bar, Alice gets it. Determine how many bars each player eats.
Input
- The first line contains , the number of bars.
- The second line contains exactly integers in left-to-right order.
Output
Print two integers and : the numbers of bars eaten by Alice and Bob, respectively.
Subtasks
- Subtask 1 (20 points): ; for all .
- Subtask 2 (30 points): ; for all .
- Subtask 3 (50 points): ; for all .
Examples
Input
5
2 9 8 2 7
Output
2 3
Explanation
Alice finishes bar at time and starts bar , which finishes at time . Bob finishes bar at time , bar at time , then takes bar . The counts are therefore for Alice and for Bob.