Find P
You are given three positive integers $N,L,$ and $R$. Find a permutation$^\dag$ $P$ of length $N$ with **minimum** number of indices $i$ satisfying $\displaystyle{L \le \sum_{j=1}^{i} P_j \le R}$. In case multiple such permutations exist, you may print any. $^\dag$A permutation of length $N$ consists of all integers from $1$ to $N$ exactly once. ### Input - The first line contains a single int
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.
Sign in to chat with the tutor and save your progress.
Sign in to start