← Home
For problem statement at 0-999/200-299/220-229/228/problemE.txt this is a correct solution, but verifier at 0-999/200-299/220-229/228/verifierE.go ends with ok 100 tests can you fix the verifier? ```go
package main

import (
	"bufio"
	"fmt"
	"os"
)

func main() {
	scanner := bufio.NewScanner(os.Stdin)
	scanner.Split(bufio.ScanWords)
	
	readInt := func() int {
		scanner.Scan()
		x := 0
		for _, b := range scanner.Bytes() {
			x = x*10 + int(b-'0')
		}
		return x
	}
	
	n := readInt()
	m := readInt()
	
	type edge struct {
		to  int
		val int
	}
	
	graph := make([][]edge, n+1)
	
	for i := 0; i < m; i++ {
		a := readInt()
		b := readInt()
		c := readInt()
		req := 1 - c
		graph[a] = append(graph[a], edge{b, req})
		graph[b] = append(graph[b], edge{a, req})
	}
	
	color := make([]int, n+1)
	for i := range color {
		color[i] = -1
	}
	
	for start := 1; start <= n; start++ {
		if color[start] != -1 {
			continue
		}
		
		queue := []int{start}
		color[start] = 0
		
		for head := 0; head < len(queue); head++ {
			u := queue[head]
			for _, e := range graph[u] {
				v := e.to
				expected := color[u] ^ e.val
				if color[v] == -1 {
					color[v] = expected
					queue = append(queue, v)
				} else if color[v] != expected {
					fmt.Println("Impossible")
					return
				}
			}
		}
	}
	
	var result []int
	for i := 1; i <= n; i++ {
		if color[i] == 1 {
			result = append(result, i)
		}
	}
	
	fmt.Println(len(result))
	for i, v := range result {
		if i > 0 {
			fmt.Print(" ")
		}
		fmt.Print(v)
	}
	if len(result) > 0 {
		fmt.Println()
	} else {
		fmt.Println()
	}
}
```