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

Submission #856444

Source Code Expand

Copy
class Main {
import java.{ util => ju }

import scala.annotation._
import scala.collection._
import scala.collection.{ mutable => mu }
import scala.collection.JavaConverters._
import scala.math._
val sc = new ju.Scanner(System.in)

def solveC() {
val x = br.readLine().split(" ").map { _.toInt }

val days = Array.ofDim[Int](n, n)
for (i <- 0 until n - 1) {
var result = 0
for (j <- i + 1 until n) {
val move = x(j) - x(j - 1)
if (move <= result) {
days(i)(j) = days(i)(j - 1)
result -= move
} else {
result = l
days(i)(j) = days(i)(j - 1) + 1
result -= move
}
}
}

for (i <- 0 until q) {
val from = fromTo.min - 1
val to = fromTo.max - 1
println(days(from)(to))
}

br.close()
}

def solveA() {
val n = sc.nextInt()
val a = sc.nextInt()
val nums = Array.fill[Int](n)(sc.nextInt())
var nowCount = 0
var total = 0l
for (i <- 1 to n) {
nowCount = i
calc(0, 0, 0)
}

def calc(count: Int, index: Int, sum: Int) {
if (count == nowCount) {
if (count * a == sum) {
total += 1
}
} else {
if (index < n) {
calc(count + 1, index + 1, sum + nums(index))
calc(count, index + 1, sum)
}
}
}

println(total)

}
}

object Main {
def main(args: Array[String]): Unit = {
val app = new Main()
app.solveA()
//    app.solveC()

}
}

#### Submission Info

Submission Time 2016-08-28 22:04:30+0900 C - Tak and Cards tochukaso Scala (2.11.7) 200 1841 Byte TLE 2105 ms 22468 KB

#### Judge Result

Score / Max Score 0 / 0 200 / 200 0 / 100
Status
 AC × 3 TLE × 1
 AC × 12
 AC × 12 TLE × 12
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 718 ms 22468 KB
example_02.txt AC 703 ms 21956 KB
example_03.txt AC 706 ms 21700 KB
example_04.txt TLE 2105 ms 21964 KB
subtask1_01.txt AC 738 ms 21948 KB
subtask1_02.txt AC 738 ms 21940 KB
subtask1_03.txt AC 718 ms 21932 KB
subtask1_04.txt AC 738 ms 21792 KB
subtask1_05.txt AC 718 ms 22080 KB
subtask1_06.txt AC 742 ms 21576 KB
subtask1_07.txt AC 762 ms 22080 KB
subtask1_08.txt AC 737 ms 21832 KB
subtask1_09.txt AC 726 ms 21936 KB
subtask2_01.txt TLE 2105 ms 21828 KB
subtask2_02.txt TLE 2105 ms 21828 KB
subtask2_03.txt TLE 2101 ms 21924 KB
subtask2_04.txt TLE 2104 ms 22080 KB
subtask2_05.txt TLE 2104 ms 21828 KB
subtask2_06.txt TLE 2105 ms 21912 KB
subtask2_07.txt TLE 2105 ms 21716 KB
subtask2_08.txt TLE 2105 ms 21956 KB
subtask2_09.txt TLE 2105 ms 21788 KB
subtask2_10.txt TLE 2105 ms 22092 KB
subtask2_11.txt TLE 2105 ms 21692 KB