← Home
For problem statement at 1000-1999/1200-1299/1200-1209/1201/problemA.txt this is a correct solution, but verifier at 1000-1999/1200-1299/1200-1209/1201/verifierA.go ends with all tests passed can you fix the verifier? package main

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

func main() {
	in := bufio.NewReader(os.Stdin)
	var n, m int
	fmt.Fscan(in, &n, &m)

	counts := make([][5]int, m)
	for i := 0; i < n; i++ {
		var s string
		fmt.Fscan(in, &s)
		for j := 0; j < m; j++ {
			counts[j][s[j]-'A']++
		}
	}

	totalScore := 0
	for j := 0; j < m; j++ {
		var a int
		fmt.Fscan(in, &a)
		max := 0
		for k := 0; k < 5; k++ {
			if counts[j][k] > max {
				max = counts[j][k]
			}
		}
		totalScore += max * a
	}

	fmt.Println(totalScore)
}