Pagini recente » Profil M@2Te4i | Monitorul de evaluare | Monitorul de evaluare | Secventa 3 | 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.