Contest Duration: - (local time) (100 minutes) Back to Home

Submission #856518

Source Code Expand

Copy
```package main

import (
"fmt"
"sort"
)

var ans int
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)
//fmt.Println(x)
//dp := make([]int, 3000)
//for i := n-1; i >=0; i-- {
//	for j := 0; j <= a; j++ {
//		if j < (dp[i + 1][j] * (i + 1) + x[i]) / i {
//			dp[i][j] = dp[i + 1][j]
//		} else {
//			dp[i][j] = max(dp[i + 1][j], dp[i + 1][j -])
//		}
//	}
//}
dfs(x, n, a, 0, 0, 0)
fmt.Println(ans)
}

func dfs(x []int, n, a, sum, m, cnt int) {
if cnt > 0 {
if sum/cnt == a && sum%cnt==0{
//fmt.Println("ヽ(*≧∀≦)ノ :", sum, cnt, sum/cnt, a)
ans++
return
} else if sum/cnt > a || m > n-1 {
return
}
}
if (n==m) {return};
dfs(x, n, a, sum+x[m], m+1, cnt+1)
dfs(x, n, a, sum, m+1, cnt)
return
}

func max(a, b int) int {
if a > b {
return a
}
return b
}
```

Submission Info

Submission Time 2016-08-28 22:08:32+0900 C - Tak and Cards fmhr Go (1.6) 0 932 Byte WA 2105 ms 512 KB

Judge Result

Score / Max Score 0 / 0 0 / 200 0 / 100
Status
 AC × 3 WA × 1
 AC × 11 WA × 1
 AC × 12 WA × 4 TLE × 8
Set Name Test Cases
Sample example_01.txt, example_02.txt, example_03.txt, example_04.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 3 ms 512 KB
example_04.txt WA 4 ms 512 KB
subtask1_01.txt AC 9 ms 512 KB
subtask1_02.txt WA 3 ms 512 KB
subtask1_03.txt AC 3 ms 512 KB
subtask1_04.txt AC 9 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 9 ms 512 KB
subtask1_09.txt AC 3 ms 512 KB
subtask2_01.txt TLE 2101 ms 512 KB
subtask2_02.txt TLE 2101 ms 512 KB
subtask2_03.txt TLE 2101 ms 512 KB
subtask2_04.txt WA 4 ms 512 KB
subtask2_05.txt AC 4 ms 512 KB
subtask2_06.txt TLE 2101 ms 512 KB
subtask2_07.txt TLE 2105 ms 512 KB
subtask2_08.txt TLE 2105 ms 512 KB
subtask2_09.txt TLE 2101 ms 512 KB
subtask2_10.txt WA 14 ms 512 KB
subtask2_11.txt TLE 2101 ms 512 KB