Submission #1517667


Source Code Expand

import java.util.Scanner

object Main {
  def solve(sc: => Scanner): Unit = {
    val N, D = sc.nextInt
    var X = sc.nextInt
    val prev = Array.fill[Int](N)(sc.nextInt)
    for (idx <- 0 until D - 1) {
      val now = Array.fill[Int](N)(sc.nextInt)
      val DP = Array.tabulate[Int](X + 1)(x => x)
      for (i <- 0 until N) {
        for (j <- 0 until X - prev(i)) {
          DP(j + prev(i)) = math.max(DP(j + prev(i)), DP(j) + now(i))
        }
      }
      //println(DP.mkString(" "))
      for (i <- 0 until DP.size) {
        X = math.max(X, DP(i) + DP.size - 1 - i)
      }
    }
    println(X)
  }

  def main(args: Array[String]): Unit = {
    val sc: Scanner = new Scanner(System.in)
    solve(sc)
  }
}

Submission Info

Submission Time
Task A - Invest Master
User goryudyuma
Language Scala (2.11.7)
Score 0
Code Size 746 Byte
Status WA
Exec Time 351 ms
Memory 27452 KB

Judge Result

Set Name All
Score / Max Score 0 / 100
Status
AC × 24
WA × 11
Set Name Test Cases
All 00_sample01.txt, 00_sample02.txt, 00_sample03.txt, 00_sample04.txt, 05_anti_greedy.txt, 10_rand_small00.txt, 10_rand_small01.txt, 10_rand_small02.txt, 10_rand_small03.txt, 10_rand_small04.txt, 10_rand_small05.txt, 10_rand_small06.txt, 10_rand_small07.txt, 10_rand_small08.txt, 10_rand_small09.txt, 20_rand_medium00.txt, 20_rand_medium01.txt, 20_rand_medium02.txt, 20_rand_medium03.txt, 20_rand_medium04.txt, 20_rand_medium05.txt, 20_rand_medium06.txt, 20_rand_medium07.txt, 20_rand_medium08.txt, 20_rand_medium09.txt, 30_rand_large00.txt, 30_rand_large01.txt, 30_rand_large02.txt, 30_rand_large03.txt, 30_rand_large04.txt, 30_rand_large05.txt, 30_rand_large06.txt, 30_rand_large07.txt, 30_rand_large08.txt, 30_rand_large09.txt
Case Name Status Exec Time Memory
00_sample01.txt AC 347 ms 25936 KB
00_sample02.txt AC 329 ms 25396 KB
00_sample03.txt AC 335 ms 23632 KB
00_sample04.txt AC 330 ms 25400 KB
05_anti_greedy.txt WA 342 ms 25384 KB
10_rand_small00.txt AC 338 ms 23740 KB
10_rand_small01.txt AC 340 ms 25544 KB
10_rand_small02.txt AC 342 ms 25024 KB
10_rand_small03.txt AC 344 ms 25400 KB
10_rand_small04.txt AC 339 ms 25148 KB
10_rand_small05.txt AC 335 ms 25504 KB
10_rand_small06.txt AC 346 ms 25548 KB
10_rand_small07.txt AC 338 ms 27440 KB
10_rand_small08.txt AC 335 ms 25376 KB
10_rand_small09.txt AC 333 ms 25560 KB
20_rand_medium00.txt AC 336 ms 25160 KB
20_rand_medium01.txt AC 332 ms 27452 KB
20_rand_medium02.txt AC 336 ms 25396 KB
20_rand_medium03.txt AC 330 ms 25408 KB
20_rand_medium04.txt AC 338 ms 25412 KB
20_rand_medium05.txt AC 331 ms 25380 KB
20_rand_medium06.txt AC 336 ms 25356 KB
20_rand_medium07.txt AC 332 ms 25420 KB
20_rand_medium08.txt AC 336 ms 25280 KB
20_rand_medium09.txt AC 334 ms 25520 KB
30_rand_large00.txt WA 350 ms 25432 KB
30_rand_large01.txt WA 340 ms 25640 KB
30_rand_large02.txt WA 349 ms 25272 KB
30_rand_large03.txt WA 348 ms 25524 KB
30_rand_large04.txt WA 351 ms 25284 KB
30_rand_large05.txt WA 349 ms 25548 KB
30_rand_large06.txt WA 349 ms 25672 KB
30_rand_large07.txt WA 347 ms 25412 KB
30_rand_large08.txt WA 350 ms 25640 KB
30_rand_large09.txt WA 351 ms 25408 KB