← All problemsSign in

Weird Values

CodeChefRating 2393Open on judge ↗

You are given an array $A = [A_1, A_2, \ldots, A_N]$ containing $N$ integers. Consider any subarray $[A_L, A_{L+1}, \ldots, A_R]$ of this subarray (where $1\leq L \leq R \leq N$). Ther `weirdness` of this subarray, denoted $w(L, R)$, is defined to be the number of indices $L \leq i \leq R$ such that $A_i$ equals the number of occurrences of $A_i$ in this subarray. Formally, we define $w(L, R)$ f

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