← All problemsSign in

Panic! at the Disco

CodeChefRating 2863Open on judge ↗

You are given a $K \times K$ matrix $M$. For each $r$ and $c$ ($1 \le r, c \le K$), let's denote the element in the $r$-th row and $c$-th column by $M_{r, c}$. You are also given three integers $N$, $a$ and $d$. Let's define a $K \times K$ matrix $$S = \sum_{i=0}^N F_{a + i \cdot d} \cdot M^i \,.$$ Here, $M^0$ is the identity matrix and for any non-negative integer $i$, $F_i$ is the $i$-th Fibon

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