Interesting Korean adhoc task

Revision en1, by pure_mem, 2023-10-05 09:46:56

How to solve this adhoc task?

You are given an undirected graph with $$$N$$$ vertexes and $$$M$$$ edges. Each vertex $$$i$$$ has a value, $$$a[i]$$$.

Is is possible to make all vertexes have the same value, using the following operation multiple times (or not use it at all): - If there is a vertex $$$u$$$, such that vertexes $$$v$$$ and $$$w$$$ are directly connected to it, then change $$$a[v]$$$, $$$a[w]$$$ to $$$a[v] + k$$$ and $$$a[w] + k$$$ respectively.

If it is possible, print "YES", else "NO".

$$$N$$$ <= 100000, $$$M$$$ <= 200000

Link: https://www.acmicpc.net/problem/30187

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en4 English pure_mem 2023-10-05 09:55:53 129
en3 English pure_mem 2023-10-05 09:50:54 26 Tiny change: 'spectively. \n\nIf i' -> 'spectively, where $k$ is any integer. \n\nIf i'
en2 English pure_mem 2023-10-05 09:47:39 5 Tiny change: 't at all):\n- If the' -> 't at all): <br>\n- If the'
en1 English pure_mem 2023-10-05 09:46:56 582 Initial revision (published)