結果
問題 | No.583 鉄道同好会 |
ユーザー |
![]() |
提出日時 | 2017-10-27 23:24:29 |
言語 | Nim (2.2.0) |
結果 |
CE
(最新)
AC
(最初)
|
実行時間 | - |
コード長 | 1,252 bytes |
コンパイル時間 | 795 ms |
コンパイル使用メモリ | 66,584 KB |
最終ジャッジ日時 | 2024-06-30 03:19:45 |
合計ジャッジ時間 | 1,623 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
コンパイルエラー時のメッセージ・ソースコードは、提出者また管理者しか表示できないようにしております。(リジャッジ後のコンパイルエラーは公開されます)
ただし、clay言語の場合は開発者のデバッグのため、公開されます。
ただし、clay言語の場合は開発者のデバッグのため、公開されます。
コンパイルメッセージ
/home/judge/data/code/Main.nim(48, 30) Error: type mismatch: got 'seq[int]' for 'map(split(readLine(stdin), {' ', '\t', '\v', '\r', '\n', '\f'}, -1), parseInt)' but expected 'tuple'
ソースコード
import sequtils,strutilstypeunionfindtree[I : static[int]] = array[I,int]proc find(U : unionfindtree; a : int, b :int): bool=vars = at = bwhile s != U[s]:s = U[s]while t != U[t]:t = U[t]return s == tproc union(U : var unionfindtree; a : int ; b : int)=if U.find(a,b):returnvars = at = bt2 : intwhile s != U[s]:s = U[s]while t != U[t]:t2 = U[t]U[t] = st = t2U[t] = sproc root(U : unionfindtree, a :int):int=vars = awhile s != U[s]:s = U[s]return svarN, M : inta, b : intut : unionfindtree[501]cnt : array[501, int]m = -1cntodd : intfor i in 0..500:ut[i] = i(N, M) = stdin.readline.split.map(parseInt)for n in 1..M:(a, b) = stdin.readline.split.map(parseInt)ut.union(a, b)cnt[a] += 1cnt[b] += 1for i in 0..<N:if (cnt[i] and 1) == 1:cntodd += 1varr = ut.root(i)if r == i:continueelif m == -1:m = relif r != m:m = -2breakif m == -2:echo "NO"elif cntodd > 2:echo "NO"else:echo "YES"