AtCoder Beginner Contest 139 Task F Engines
Subject to the effect
$ $ A given n-dimensional vectors, to choose the number, and the mold such that their maximum.
analysis
This is a classic problem, there is a formulation is:
Given $ n-$ two-dimensional vector $ v_1, v_2, \ dots, v_n $, find a set of coefficients $ a_1, a_2, \ dots, a_n $ ($ 0 \ le a_i \ le 1 $) such that $ \ sum_ {i = 1} ^ {n} a_i v_i $ maximum modulus.
Easily proved: For the optimal solution, $ a_i $ is either 1 or 0; then reduced to the selection of an optimal subset of problems.
It can be shown that the optimal solution to meet the following two properties:
- The set of vectors in an optimal solution using a minimal number of vectors must all lie in an open half-plane. Vector comprising a minimum number of optimal solution, all vectors in an open half-plane
If you add "a vector selected in the opening half-plane," this limitation, we can immediately deduce, if put all those vector vector Sort by polar angle is selected must be continuous period. In other words,
- Continuous section comprises a minimum number for the optimal solution vectors, wherein the vector is sorted by the polar angle. The vectors in the optimal solution using a minimal number of vectors are contiguous when ordered according to angle circularly.