← Home
For problem statement at 0-999/500-599/570-579/577/problemB.txt this is a correct solution, but verifier at 0-999/500-599/570-579/577/verifierB.go ends with All 100 tests passed can you fix the verifier? package main

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

func main() {
	scanner := bufio.NewScanner(os.Stdin)
	scanner.Split(bufio.ScanWords)
	
	if !scanner.Scan() {
		return
	}
	n, _ := strconv.Atoi(scanner.Text())
	
	if !scanner.Scan() {
		return
	}
	m, _ := strconv.Atoi(scanner.Text())

	if n >= m {
		fmt.Println("YES")
		return
	}

	dp := make([]bool, m)
	for i := 0; i < n; i++ {
		scanner.Scan()
		x, _ := strconv.Atoi(scanner.Text())
		v := x % m
		
		nextDp := make([]bool, m)
		copy(nextDp, dp)
		nextDp[v] = true
		
		for j := 0; j < m; j++ {
			if dp[j] {
				nextDp[(j+v)%m] = true
			}
		}
		
		dp = nextDp
		if dp[0] {
			fmt.Println("YES")
			return
		}
	}
	
	fmt.Println("NO")
}