Submission #4890162


Source Code Expand

  // D - 感雨時刻の整理 https://atcoder.jp/contests/abc001/tasks/abc001_4

  import io.Source

  object Main extends App {
    val xs = Source.stdin.getLines()
    xs.next() // Nをスキップ
    val xss = xs
      .map(s => {
        val a = s.split('-')
        (a(0).toInt, a(1).toInt)
      })

//    print(solve(xss))
    solve(xss)

    def solve(xs: Iterator[(Int, Int)]): String = {
      val buf = Array.ofDim[Boolean](24 * 60 / 5 + 1)
      xs.foreach { case (l, r) =>
        val ll = ((l / 100 * 60) + (l % 100) / 5 * 5) / 5
        val rr = if (r % 5 == 0) ((r / 100 * 60) + (r % 100)) / 5 - 1
                      else ((r / 100 * 60) + (r % 100) / 5 * 5 + 5) / 5 - 1
        for (i <- ll to rr) {
          buf(i) = true
        }
      }
      var f = false
      for (i <- 0 until buf.length) {
        if (f) {
          if (!buf(i)) {
            val hh = i * 5 / 60
            val mm = (i * 5) % 60
            print("%02d".format(hh))
            println("%02d".format(mm))
            f = false
          }
        } else {
          if (buf(i)) {
            val hh = i * 5 / 60
            val mm = (i * 5) % 60
            print("%02d".format(hh))
            print("%02d".format(mm))
            print("-")
            f = true
          }
        }
      }
      ""
    }
  }

Submission Info

Submission Time
Task D - 感雨時刻の整理
User marony
Language Scala (2.11.7)
Score 100
Code Size 1364 Byte
Status AC
Exec Time 637 ms
Memory 40084 KB

Judge Result

Set Name all
Score / Max Score 100 / 100
Status
AC × 48
Set Name Test Cases
all 00_sample_01.txt, 00_sample_02.txt, 00_sample_03.txt, cho_cho_chokudai.txt, chokudai_ga_cho.txt, test_01.txt, test_02.txt, test_03.txt, test_04.txt, test_05.txt, test_06.txt, test_07.txt, test_08.txt, test_09.txt, test_10.txt, test_11.txt, test_12.txt, test_13.txt, test_14.txt, test_15.txt, test_16.txt, test_17.txt, test_18.txt, test_19.txt, test_20.txt, test_21.txt, test_22.txt, test_23.txt, test_24.txt, test_25.txt, test_26.txt, test_27.txt, test_28.txt, test_29.txt, test_30.txt, test_31.txt, test_32.txt, test_33.txt, test_34.txt, test_35.txt, test_36.txt, test_37.txt, test_38.txt, test_39.txt, test_40.txt, test_41.txt, test_42.txt, test_43.txt
Case Name Status Exec Time Memory
00_sample_01.txt AC 322 ms 25400 KB
00_sample_02.txt AC 320 ms 25256 KB
00_sample_03.txt AC 325 ms 23600 KB
cho_cho_chokudai.txt AC 612 ms 39904 KB
chokudai_ga_cho.txt AC 570 ms 40048 KB
test_01.txt AC 384 ms 25424 KB
test_02.txt AC 383 ms 23744 KB
test_03.txt AC 386 ms 25660 KB
test_04.txt AC 380 ms 25252 KB
test_05.txt AC 379 ms 25408 KB
test_06.txt AC 335 ms 25420 KB
test_07.txt AC 330 ms 25288 KB
test_08.txt AC 324 ms 25288 KB
test_09.txt AC 344 ms 25528 KB
test_10.txt AC 346 ms 25296 KB
test_11.txt AC 345 ms 25824 KB
test_12.txt AC 337 ms 25416 KB
test_13.txt AC 330 ms 25548 KB
test_14.txt AC 343 ms 25284 KB
test_15.txt AC 351 ms 25428 KB
test_16.txt AC 330 ms 25140 KB
test_17.txt AC 341 ms 27640 KB
test_18.txt AC 327 ms 25288 KB
test_19.txt AC 338 ms 25152 KB
test_20.txt AC 340 ms 23612 KB
test_21.txt AC 564 ms 39208 KB
test_22.txt AC 609 ms 39432 KB
test_23.txt AC 542 ms 39240 KB
test_24.txt AC 602 ms 37424 KB
test_25.txt AC 569 ms 37844 KB
test_26.txt AC 598 ms 39328 KB
test_27.txt AC 600 ms 39688 KB
test_28.txt AC 588 ms 37636 KB
test_29.txt AC 328 ms 23588 KB
test_30.txt AC 330 ms 25284 KB
test_31.txt AC 460 ms 30992 KB
test_32.txt AC 324 ms 25296 KB
test_33.txt AC 573 ms 39280 KB
test_34.txt AC 325 ms 25152 KB
test_35.txt AC 336 ms 25248 KB
test_36.txt AC 621 ms 38004 KB
test_37.txt AC 618 ms 39236 KB
test_38.txt AC 605 ms 35880 KB
test_39.txt AC 580 ms 39180 KB
test_40.txt AC 579 ms 40084 KB
test_41.txt AC 610 ms 38836 KB
test_42.txt AC 637 ms 39980 KB
test_43.txt AC 581 ms 39392 KB