codeforces-scrape

Codeforces scraped problems and editorials
git clone git://git.laack.co/codeforces-scrape.git
Log | Files | Refs | README

6C.md (1378B)


      1 Source: https://codeforces.com/problemset/problem/6/C
      2 
      3 C. Alice, Bob and Chocolate
      4 
      5 time limit per test
      6 
      7 2 seconds
      8 
      9 memory limit per test
     10 
     11 64 megabytes
     12 
     13 input
     14 
     15 stdin
     16 
     17 output
     18 
     19 stdout
     20 
     21 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.
     22 
     23 How many bars each of the players will consume?
     24 
     25 Input
     26 
     27 The first line contains one integer *n* (1 ≤ *n* ≤ 105) — the amount of bars on the table. The second line contains a sequence *t*1, *t*2, ..., *t**n* (1 ≤ *t**i* ≤ 1000), where *t**i* is the time (in seconds) needed to consume the *i*-th bar (in the order from left to right).
     28 
     29 Output
     30 
     31 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.
     32 
     33 Examples
     34 
     35 Input
     36 
     37 ```
     38 5  
     39 2 9 8 2 7
     40 ```
     41 
     42 Output
     43 
     44 ```
     45 2 3
     46 ```