package main import ( "fmt" "strconv" "strings" ) func main() { var N, D, K int fmt.Scan(&N, &D, &K) total := 0 lastChoice := 0 for k := 1; k <= K && lastChoice <= N; { total += (lastChoice + 1) if total > D { break } lastChoice++ k++ } diff := D - total if diff < 0 { fmt.Println(-1) return } endNum := N + 1 midChoice := 0 for i := 0; i < K; i++ { if diff - (endNum - 1) + lastChoice >= 0 { diff -= (endNum - 1) - lastChoice lastChoice-- endNum-- } else if diff > 0 { midChoice = lastChoice + diff lastChoice-- diff = 0 } } if diff > 0 { fmt.Println(-1) return } ans := make([]int, 0) for i := 1; i <= lastChoice; i++ { ans = append(ans, i) } if midChoice > 0 { ans = append(ans, midChoice) } for k := endNum; k <= N; k++ { ans = append(ans, k) } PrintI(ans...) } func PrintI(args ...int) { fmt.Println(strings.Join(mapToString(args), " ")) } func mapToString(arr []int) []string { ret := make([]string, len(arr)) for i := 0; i < len(arr); i++ { ret[i] = strconv.Itoa(arr[i]) } return ret }