7 4 3 1 2 1000 2000 3000
6004
6004
6004
6001
5007
4007
4007
4007
* We will explain one optimal strategy for Snuke when Ant initially stands at the position $7$.
* Snuke chooses the candy of tastiness $1$.
* The candies to the left and right of Ant have the tastinesses of $3$ and $2$, respectively. She chooses the one with the greater tastiness, that is, the one with tastiness $3$.
* Snuke chooses the candy of tastiness $1000$.
* The candies to the left and right of Ant have the tastinesses of $4$ and $2$, respectively. She chooses the one with the greater tastiness, that is, the one with tastiness $4$.
* Snuke chooses the candy of tastiness $2000$.
* There is no candy to the left of Ant, and the candy to the right of Ant has the tastiness of $2$. She chooses this candy with tastiness $2$.
* Snuke chooses the candy of tastiness $3000$.
* The sum of the tastinesses of candies Snuke has taken is $6001$. There is no way to take candies that results in a greater total tastiness.40 45651 92206 55173 24815 34809 73343 60978 57984 6919 89624 19693 30037 87070 6713 65976 37597 51929 93304 70911 7343 65414 38977 47998 52123 53590 35714 59319 50872 53850 40991 85668 8808 32846 70831 3416 42173 89538 73410 21502 69631
1416699 1416699 1416699 1416699 1413888 1410894 1410894 1410894 1413888 1413888 1413888 1413888 1413888 1413888 1419943 1419943 1419943 1400961 1400961 1400961 1419943 1419943 1419943 1419749 1419749 1419749 1419749 1419749 1419749 1419749 1419749 1419749 1419943 1419943 1419943 1419943 1398462 1398462 1398462 1402241 1402241
{
"problem": {
"name": "Greedy Ant",
"description": {
"content": "There are $N$ candies on a number line. The $i$\\-th candy from the left is at the position $2i$ and has the tastiness of $a_i$. Here, it is guaranteed that the tastinesses of all candies are distinct.",
"description_type": "Markdown"
},
"platform": "AtCoder",
"limit": {
"time_limit": 3000,
"memory_limit": 262144
},
"difficulty": "None",
"is_remote": true,
"is_sync": true,
"sync_url": null,
"sign": "keyence2021_e"
},
"statements": [
{
"statement_type": "Markdown",
"content": "There are $N$ candies on a number line. The $i$\\-th candy from the left is at the position $2i$ and has the tastiness of $a_i$. Here, it is guaranteed that the tastinesses of all candies are distinct....",
"is_translate": false,
"language": "English"
}
]
}