← Home
For problem statement at 1000-1999/1200-1299/1240-1249/1249/problemD1.txt this is a correct solution, but verifier at 1000-1999/1200-1299/1240-1249/1249/verifierD1.go ends with case 1 failed
input:
10 3
131 132
113 176
196 197
81 111
78 81
135 180
78 192
5 190
71 181
120 181
expected:
3
10 8 7
got:
3
7 8 9

exit status 1 can you fix the verifier? ```go
package main

import (
    "fmt"
    "sort"
)

func main() {
    var n, k int
    fmt.Scan(&n, &k)
    
    l := make([]int, n)
    r := make([]int, n)
    
    for i := 0; i < n; i++ {
        fmt.Scan(&l[i], &r[i])
    }
    
    removed := make([]bool, n)
    cnt := 0
    
    for x := 1; x <= 200; x++ {
        type seg struct {
            r, idx int
        }
        active := []seg{}
        
        for i := 0; i < n; i++ {
            if !removed[i] && l[i] <= x && x <= r[i] {
                active = append(active, seg{r[i], i})
            }
        }
        
        sort.Slice(active, func(i, j int) bool {
            return active[i].r > active[j].r
        })
        
        for len(active) > k {
            removed[active[0].idx] = true
            cnt++
            active = active[1:]
        }
    }
    
    fmt.Println(cnt)
    
    result := []int{}
    for i := 0; i < n; i++ {
        if removed[i] {
            result = append(result, i+1)
        }
    }
    
    for i, idx := range result {
        if i > 0 {
            fmt.Print(" ")
        }
        fmt.Print(idx)
    }
    fmt.Println()
}
```