Жишээ тэстүүд

Оролт
2 2 1
1 1
2 1 1
Гаралт
3
Оролт
4 3 2
1 2 3 4
2 1 5
3 4 2
Гаралт
12

Тэмдэглэл

In the first sample it is best to first eat the second dish, then the first one. Then we get one unit of satisfaction for each dish and plus one more for the rule.

In the second test the fitting sequences of choice are 4 2 1 or 2 1 4. In both cases we get satisfaction 7 for dishes and also, if we fulfill rule 1, we get an additional satisfaction 5.