← All problemsSign in

Circular Permutation Recovery

CodeChefRating 2927Open on judge ↗

You are given two integers $N, K$ such that $K + 1 \le N \le 2K-1$. Your friend is hiding from you a permutation $(P_1, P_2, \ldots, P_N)$ of integers from $1$ to $N$, whose elements are written cyclically. Your friend doesn't tell you the permutation. Instead, he tells you this. For each $i$ from $1$ to $N$ he will tell you $A_i$ $-$ the number of such integers $j$ with $0 \le j < K$ such that $

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