Submission #421383
Source Code Expand
n,q = gets.split.map(&:to_i) f = Hash[*([*0..(n+1)].map{|x| [x,x]}.flatten)] q.times do p,a,b = gets.split.map(&:to_i) a,b = [a,b].minmax case p when 0 f[b] = f[a] when 1 puts (f[b] == f[a]) ? 'Yes' : 'No' end end
Submission Info
Submission Time | |
---|---|
Task | B - Union Find |
User | satos |
Language | C++ (GCC 4.9.2) |
Score | 0 |
Code Size | 258 Byte |
Status | CE |
Compile Error
./Main.cpp:3:14: error: too many decimal points in number f = Hash[*([*0..(n+1)].map{|x| [x,x]}.flatten)] ^ ./Main.cpp:14:27: warning: multi-character character constant [-Wmultichar] puts (f[b] == f[a]) ? 'Yes' : 'No' ^ ./Main.cpp:14:35: warning: multi-character character constant [-Wmultichar] puts (f[b] == f[a]) ? 'Yes' : 'No' ^ ./Main.cpp:1:1: error: ‘n’ does not name a type n,q = gets.split.map(&:to_i) ^ ./Main.cpp:3:38: error: expected unqualified-id before ‘.’ token f = Hash[*([*0..(n+1)].map{|x| [x,x]}.flatten)] ^