← Home
```go
package main

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

func main() {
	reader := bufio.NewReader(os.Stdin)
	writer := bufio.NewWriter(os.Stdout)
	defer writer.Flush()

	var n, m, k int
	fmt.Fscan(reader, &n, &m, &k)

	a := make([]int, n)
	for i := 0; i < n; i++ {
		fmt.Fscan(reader, &a[i])
	}

	// We need to split array into k subarrays, each with at least m elements.
	// Beauty of a subarray = sum of m largest elements.
	// We want to maximize total beauty.
	
	// Key insight: The total beauty = sum of top m elements from each subarray.
	// If we think about it greedily, we want the largest elements overall to each 
	// "count" (be in the top m of their subarray). 
	
	// Total elements that contribute to beauty: m*k elements.
	// We want to maximize the sum of these contributing elements.
	// The best we can do is to have the top m*k elements of the entire array all contribute.
	
	// Strategy: Sort indices by value (descending). Take the top m*k elements.
	// We need to place partition boundaries such that each subarray has at least m elements
	// and all top m*k elements are "covered" (i.e., each subarray contains exactly m of them
	// in its top... well, we just need each subarray to have at least m elements, and ideally
	// all top m*k elements contribute).
	
	// Actually, every element in the top-m of a subarray contributes. If we pick the globally
	// top m*k elements, they will all contribute as long as no subarray contains more than m
	// of them (since each subarray only counts m largest). Wait, actually if a subarray has 
	// more than m of the top m*k elements, those extra ones still contribute (they're in the
	// top m of that subarray if they're the largest there).
	
	// Let me reconsider. We want to select exactly m*k elements to be "beauty contributors".
	// The maximum sum is achieved when we select the m*k largest elements. Then we need to
	// partition such that each subarray has exactly m selected elements (and at least m total).
	
	// Approach: Take indices of top m*k elements (sorted by position). Place cuts after every
	// m-th selected element (from the right/largest), ensuring each subarray has >= m elements.
	
	// Sort indices by value descending, pick top m*k
	indices := make([]int, n)
	for i := 0; i < n; i++ {
		indices[i] = i
	}
	sort.Slice(indices, func(i, j int) bool {
		return a[indices[i]] > a[indices[j]]
	})

	selected := make([]bool, n)
	totalBeauty := int64(0)
	for i := 0; i < m*k; i++ {
		selected[indices[i]] = true
		totalBeauty += int64(a[indices[i]])
	}

	// Now collect positions of selected elements in order
	selPos := make([]int, 0, m*k)
	for i := 0; i < n; i++ {
		if selected[i] {
			selPos = append(selPos, i)
		}
	}

	// We need to place k-1 cuts. Each subarray must have exactly m selected elements.
	// Go through selPos and after every m-th selected element, place a cut (after that element's position).
	// But we also need each subarray to have at least m total elements.
	// Since m*k <= n, we have enough elements. The last subarray gets the remaining.
	
	// Place cuts after the m-th, 2m-th, ..., (k-1)*m-th selected element.
	cuts := make([]int, 0, k-1)
	for i := m; i < m*k; i += m {
		// Cut after position selPos[i-1], meaning first part ends at selPos[i-1]
		// p = selPos[i-1] + 1 (1-indexed: elements 1..p in one subarray)
		cuts = append(cuts, selPos[i-1]+1) // 1-indexed cut point
	}

	// But we need to ensure each subarray has at least m elements.
	// Each of the first k-1 subarrays has exactly m selected elements.
	// Minimum size = m (if no non-selected elements are between cuts).
	// But what if cuts are too close? Since each has m selected elements, size >= m. ✓
	// Last subarray: remaining elements from cuts[k-2]+1 to n. It has m selected and possibly more. Size >= m. ✓

	fmt.Fprintln(writer, totalBeauty)
	for i, c := range cuts {
		if i > 0 {
			fmt.Fprint(writer, " ")
		}
		fmt.Fprint(writer, c)
	}
	fmt.Fprintln(writer)
}
```