Submission #858057


Source Code Expand

Copy
package main

import (
	"fmt"
	"sort"
)

func main() {
	var n, a int
	fmt.Scan(&n, &a)
	x := make([]int, n)
	for i := 0; i < n; i++ {
		fmt.Scan(&x[i])
	}
	sort.Ints(x)
	var ans int
	var dfs func(int, int, int)
	dfs = func(m, sum, cnt int) {
		if cnt > 0 {
			if sum/cnt == a && sum%cnt == 0 {
				ans++
				if m < n {
					dfs(m+1, sum+x[m], cnt+1)
				}
				return

			}
		}
		if n == m {
			return
		}
		dfs(m+1, sum+x[m], cnt+1)
		dfs(m+1, sum, cnt)
		return
	}
	dfs(0, 0, 0)
	fmt.Println(ans)
}

Submission Info

Submission Time
Task C - Tak and Cards
User fmhr
Language Go (1.6)
Score 0
Code Size 538 Byte
Status WA
Exec Time 2105 ms
Memory 512 KB

Judge Result

Set Name Sample Subtask1 All
Score / Max Score 0 / 0 0 / 200 0 / 100
Status
AC × 3
WA × 1
AC × 11
WA × 1
AC × 11
WA × 3
TLE × 10
Set Name Test Cases
Sample example_01.txt, example_02.txt, example_03.txt, example_04.txt
Subtask1 example_01.txt, example_02.txt, example_03.txt, subtask1_01.txt, subtask1_02.txt, subtask1_03.txt, subtask1_04.txt, subtask1_05.txt, subtask1_06.txt, subtask1_07.txt, subtask1_08.txt, subtask1_09.txt
All example_01.txt, example_02.txt, example_03.txt, example_04.txt, subtask1_01.txt, subtask1_02.txt, subtask1_03.txt, subtask1_04.txt, subtask1_05.txt, subtask1_06.txt, subtask1_07.txt, subtask1_08.txt, subtask1_09.txt, subtask2_01.txt, subtask2_02.txt, subtask2_03.txt, subtask2_04.txt, subtask2_05.txt, subtask2_06.txt, subtask2_07.txt, subtask2_08.txt, subtask2_09.txt, subtask2_10.txt, subtask2_11.txt
Case Name Status Exec Time Memory
example_01.txt AC 3 ms 512 KB
example_02.txt AC 3 ms 512 KB
example_03.txt AC 4 ms 512 KB
example_04.txt WA 4 ms 512 KB
subtask1_01.txt AC 8 ms 512 KB
subtask1_02.txt WA 4 ms 512 KB
subtask1_03.txt AC 7 ms 512 KB
subtask1_04.txt AC 7 ms 512 KB
subtask1_05.txt AC 7 ms 512 KB
subtask1_06.txt AC 3 ms 512 KB
subtask1_07.txt AC 3 ms 512 KB
subtask1_08.txt AC 7 ms 512 KB
subtask1_09.txt AC 5 ms 512 KB
subtask2_01.txt TLE 2105 ms 512 KB
subtask2_02.txt TLE 2105 ms 512 KB
subtask2_03.txt TLE 2105 ms 512 KB
subtask2_04.txt WA 4 ms 512 KB
subtask2_05.txt TLE 2105 ms 512 KB
subtask2_06.txt TLE 2105 ms 512 KB
subtask2_07.txt TLE 2105 ms 512 KB
subtask2_08.txt TLE 2105 ms 512 KB
subtask2_09.txt TLE 2105 ms 512 KB
subtask2_10.txt TLE 2105 ms 512 KB
subtask2_11.txt TLE 2105 ms 512 KB