← Home
For problem statement at 1000-1999/1100-1199/1180-1189/1187/problemC.txt this is a correct solution, but verifier at 1000-1999/1100-1199/1180-1189/1187/verifierC.go ends with All tests passed can you fix the verifier? package main

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

type Query struct {
	l, r int
}

func main() {
	in := bufio.NewReaderSize(os.Stdin, 1<<20)
	out := bufio.NewWriterSize(os.Stdout, 1<<20)
	defer out.Flush()

	var n, m int
	fmt.Fscan(in, &n, &m)

	good := make([]bool, n-1)
	var zero []Query

	for i := 0; i < m; i++ {
		var t, l, r int
		fmt.Fscan(in, &t, &l, &r)
		if t == 1 {
			for j := l - 1; j <= r-2; j++ {
				good[j] = true
			}
		} else {
			zero = append(zero, Query{l - 1, r - 2})
		}
	}

	for _, q := range zero {
		ok := false
		for i := q.l; i <= q.r; i++ {
			if !good[i] {
				ok = true
				break
			}
		}
		if !ok {
			fmt.Fprintln(out, "NO")
			return
		}
	}

	a := make([]int, n)
	a[0] = 1000000000
	for i := 1; i < n; i++ {
		if good[i-1] {
			a[i] = a[i-1]
		} else {
			a[i] = a[i-1] - 1
		}
	}

	fmt.Fprintln(out, "YES")
	for i := 0; i < n; i++ {
		if i > 0 {
			fmt.Fprint(out, " ")
		}
		fmt.Fprint(out, a[i])
	}
	fmt.Fprintln(out)
}