|시간 제한||메모리 제한||제출||정답||맞은 사람||정답 비율|
|1 초||128 MB||13||8||7||58.333%|
Farmer John has invented a new way of feeding his cows. He lays out N (1 <= N <= 700,000) hay bales conveniently numbered 1..N in a long line in the barn. Hay bale i has weight W_i (1 <= W_i <= 2,000,000,000). A sequence of six weights might look something like:
17 5 9 10 3 8
A pair of cows named Bessie and Dessie walks down this line after examining all the haybales to learn their weights. Bessie is the first chooser. They take turns picking haybales to eat as they walk (once a haybale is skipped, they cannot return to it). For instance, if cows Bessie and Dessie go down the line, a possible scenario is:
Bessie | | 17 5 9 10 3 8 Dessie | |
This scenario only shows a single skipped bale; either cow can skip as many as she pleases when it's her turn.
Each cow wishes to maximize the total weight of hay she herself consumes (and each knows that the other cow has this goal). Furthermore, a cow will choose to eat the first bale of hay that maximimizes her total weight consumed.
Given a sequence of hay weights, determine the amount of hay that a pair of cows will eat as they go down the line of hay.
6 17 5 9 10 3 8