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

Оролт
5
10 20 30
1 1 1 1 50
Гаралт
2
Оролт
5
10 20 30
1 1 1 1 51
Гаралт
3
Оролт
7
30 20 10
34 19 50 33 88 15 20
Гаралт
-1
Оролт
6
10 5 10
10 9 5 25 20 5
Гаралт
3

Тэмдэглэл

In the first sample Athos has strength 10, Borthos 20, and Caramis 30. They can defeat all criminals in two hours:

  • Borthos and Caramis should together fight a criminal with strength 50. In the same hour Athos can fight one of four criminals with strength 1.
  • There are three criminals left, each with strength 1. Each musketeer can fight one criminal in the second hour.

In the second sample all three musketeers must together fight a criminal with strength 51. It takes one hour. In the second hour they can fight separately, each with one criminal. In the third hour one criminal is left and any of musketeers can fight him.