4 8 4 1 5 3 2 4 1 5 3
3 Consider the scenario where Takahashi arranges the dishes in the order $2, 3, 1, 4$. * First, Snuke eats dish $2$. The total sweetness so far is $3$, and the total saltiness is $2$. * Next, Snuke eats dish $3$. The total sweetness so far is $7$, and the total saltiness is $3$. * Next, Snuke eats dish $1$. The total sweetness so far is $8$, and the total saltiness is $8$. * The total saltiness has exceeded $Y=4$, so Snuke will not eat any further dishes. Thus, in this arrangement, Snuke will eat three dishes. No matter how Takahashi arranges the dishes, Snuke will not eat all four dishes, so the answer is $3$.
2 1 1 3 2 3 2
1
2 100 100 3 2 3 2
2
6 364 463 230 381 154 200 328 407 339 94 193 10 115 309
3
{
"problem": {
"name": "Maximum Glutton",
"description": {
"content": "Takahashi has prepared $N$ dishes for Snuke. The dishes are numbered from $1$ to $N$, and dish $i$ has a **sweetness** of $A_i$ and a **saltiness** of $B_i$. Takahashi can arrange these dishes in any ",
"description_type": "Markdown"
},
"platform": "AtCoder",
"limit": {
"time_limit": 3000,
"memory_limit": 262144
},
"difficulty": "None",
"is_remote": true,
"is_sync": true,
"sync_url": null,
"sign": "abc364_e"
},
"statements": [
{
"statement_type": "Markdown",
"content": "Takahashi has prepared $N$ dishes for Snuke. The dishes are numbered from $1$ to $N$, and dish $i$ has a **sweetness** of $A_i$ and a **saltiness** of $B_i$.\nTakahashi can arrange these dishes in any ...",
"is_translate": false,
"language": "English"
}
]
}