C. Vasya And The Mushrooms
Educational Codeforces Round 48 (Rated for Div. 2)
C. Vasya And The Mushrooms
time limit per test
2 seconds
memory limit per test
256 megabytes
input
standard input
output
standard output
Vasya's house is situated in a forest, and there is a mushroom glade near it. The glade consists of two rows, each of which can be divided into n consecutive cells. For each cell Vasya knows how fast the mushrooms grow in this cell (more formally, how many grams of mushrooms grow in this cell each minute). Vasya spends exactly one minute to move to some adjacent cell. Vasya cannot leave the glade. Two cells are considered adjacent if they share a common side. When Vasya enters some cell, he instantly collects all the mushrooms growing there.
Vasya begins his journey in the le