← Home
For problem statement at 0-999/400-499/490-499/493/problemA.txt this is a correct solution, but verifier at 0-999/400-499/490-499/493/verifierA.go ends with All tests passed can you fix the verifier? package main

import (
	"fmt"
)

func main() {
	var homeTeam, awayTeam string
	fmt.Scan(&homeTeam, &awayTeam)

	var n int
	fmt.Scan(&n)

	yellows := make(map[string]int)
	reds := make(map[string]bool)

	for i := 0; i < n; i++ {
		var t, m int
		var team, card string
		fmt.Scan(&t, &team, &m, &card)

		key := fmt.Sprintf("%s-%d", team, m)
		if reds[key] {
			continue
		}

		if card == "r" {
			reds[key] = true
			teamName := homeTeam
			if team == "a" {
				teamName = awayTeam
			}
			fmt.Printf("%s %d %d\n", teamName, m, t)
		} else if card == "y" {
			yellows[key]++
			if yellows[key] == 2 {
				reds[key] = true
				teamName := homeTeam
				if team == "a" {
					teamName = awayTeam
				}
				fmt.Printf("%s %d %d\n", teamName, m, t)
			}
		}
	}
}