← All problemsSign in

Yet Another Queries Problem

You are given a graph $G$ with $n$ nodes and $m$ edges. You are also given an array $C$ of $n$ integers where $C_i$ is the value of node $i$. You have to perform queries of two types, - `1 x y` : remove the $x-y$ edge from the graph $G$. - `2` : print the number of [unordered pairs](https://en.wikipedia.org/wiki/Unordered_pair) $\{i,j\}$ such that $i$ and $j$ belong to different [connected comp

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