← All problemsSign in

Rotate the Polyline

CodeChefRating 2819Open on judge ↗

Chef John is given $N$ points $\mathsf{P}_1, \mathsf{P}_2, \ldots, \mathsf{P}_N$ in a plane. For each valid $i$, the coordinates of the point $\mathsf{P}_i$ are $(x_i, y_i)$. Help him find a vector $\overrightarrow{v} = (x_v, y_v)$ such that the following holds: - For each $i$ ($1 \le i \le N$), let $S_i = \overrightarrow{v} \cdot \overrightarrow{\mathsf{P}_i \mathsf{P}_{i+1}}$. Here, we define $

HINT LADDERno hints yet
L1 Observation
L2 Technique
L3 Approach
L4 Pseudo-code
🔒
L5 Full solution
L5 unlocks only if you insist twice
solution.cppC++17

CodeSearch Tutor

Hints, not spoilers — it won’t hand over the full solution unless you insist.

voice by Sarvam AI

Sign in to chat with the tutor and save your progress.

Sign in to start