Pagini recente » Cod sursa (job #2643818) | Cod sursa (job #660431) | Cod sursa (job #1996981) | Cod sursa (job #239029) | Diferente pentru problema/connectthetree intre reviziile 2 si 3
Nu exista diferente intre titluri.
Diferente intre continut:
You are given a tree with $N$ nodes. You should process $M$ queries of two types:
$1$ $x$ $y$: ($x, y$) is an edge from the initial tree. If the edge ($x, y$) is still in the tree, delete it, else add it back.
$1$ $x$ $y$: (x, y) is an edge from the initial tree. If the edge (x, y) is still in the tree, delete it, else add it back.
$2$ $x$ $y$: this output is either $0$ or $1$. Consider that total is the sum of all the previous type 2 queries. Then compute $x_new$ = ($x + total$) mod $N$ + $1$, $y_new$ = ($y + total$) mod $N$ + $1$.
$2$ $x$ $y$: this output is either $0$ or $1$. Consider that total is the sum of all the previous type 2 queries. Then compute $x_new$ = (x + total) mod $N$ + $1$, $y_new$ = (y + total) mod $N$ + $1$.
Output $1$ if you can reach $y_new$ from $x_new$, or $0$ if you cannot.
Nu exista diferente intre securitate.
Topicul de forum nu a fost schimbat.