Submission #732210
Source Code Expand
object Main extends App { 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) solveD() def solveA() { println(sc.nextInt() - sc.nextInt()) } def solveB() { val m = sc.nextInt() val s = m match { case (a) if a < 100 => "00" case (a) if a < 6000 => "%02d".format(a / 100) case (a) if a < 35000 => a / 1000 + 50 case (a) if a <= 70000 => (a / 1000 - 30) / 5 + 80 case _ => "89" } println(s) } def solveC() { val deg, dis = sc.nextInt() val sPerm = scala.math.BigDecimal(dis.toDouble / 60.0).setScale(1, scala.math.BigDecimal.RoundingMode.HALF_UP).toDouble val windPow = getWindPower(sPerm) if (windPow == 0) { println("C 0") return } val windDir = getWindDir(deg) println(windDir + " " + windPow) } def solveD() { val N = sc.nextInt() var table = new Array[Int](24 * 60 / 5 + 1) (0 until N).foreach { _ => val Array(s, e) = sc.next().split("-").map(_.toInt).map(x => x / 100 * 60 + x % 100) table(s / 5) += 1 table((e + 4) / 5) -= 1 } // println(table.deep) var s = -1 var v = 0 for (i <- 0 until table.length) { v += table(i) if (s > -1 && v == 0) { printf("%02d%02d-%02d%02d\r\n", s * 5 / 60, s * 5 % 60, i * 5 / 60, i * 5 % 60) s = -1 } else if (s == -1 && v > 0) { s = i } } } def solveDOther() { val table = Array.fill(1441)(0) (1 to sc.nextInt()).foreach { _ => val Array(s, e) = sc.next().split("-").map(_.toInt).map(x => (x / 100 * 60) + (x % 100)) val s2 = s / 5 * 5 val e2 = if (e % 5 == 0) e else (e / 5 + 1) * 5 table(s2) += 1 table(e2) -= 1 } var start: List[Int] = Nil var end: List[Int] = Nil table.zipWithIndex.foldLeft(0) { case (acc, (c, i)) => val sum = acc + c if (acc == 0 && c >= 1) start ::= i if (acc >= 1 && sum == 0) end ::= i sum } def minToHHMM(min: Int) = (min / 60).formatted("%02d") + (min % 60).formatted("%02d") (start zip end).reverse.map { case (s, e) => minToHHMM(s) + "-" + minToHHMM(e) }.foreach(println) def t2n(x: Int) = (x / 100) * 12 + (x % 100) / 5 // hhmm -> 5min table index def n2t(x: Int) = (x / 12) * 100 + (x % 12) * 5 // 5min table index -> hhmm } def getWindDir(s: Int): String = { var index = 112 s match { case (a) if a <= index => "N" case (a) if a <= index + 225 * 1 => "NNE" case (a) if a <= index + 225 * 2 => "NE" case (a) if a <= index + 225 * 3 => "ENE" case (a) if a <= 1012 => "E" case (a) if a <= 1237 => "ESE" case (a) if a <= 1462 => "SE" case (a) if a <= 1687 => "SSE" case (a) if a <= 1912 => "S" case (a) if a <= 2137 => "SSW" case (a) if a <= 2362 => "SW" case (a) if a <= 2587 => "WSW" case (a) if a <= 2812 => "W" case (a) if a <= 3037 => "WNW" case (a) if a <= 3262 => "NW" case (a) if a <= 3487 => "NNW" case _ => "N" } } def getWindPower(s: Double): Int = { s match { case (a) if a < 0.3 => 0 case (a) if a < 1.6 => 1 case (a) if a < 3.4 => 2 case (a) if a < 5.5 => 3 case (a) if a < 8.0 => 4 case (a) if a < 10.8 => 5 case (a) if a < 13.9 => 6 case (a) if a < 17.2 => 7 case (a) if a < 20.8 => 8 case (a) if a < 24.5 => 9 case (a) if a < 28.5 => 10 case (a) if a < 32.7 => 11 case _ => 12 } } }
Submission Info
Submission Time | |
---|---|
Task | D - 感雨時刻の整理 |
User | tochukaso |
Language | Scala (2.9.1) |
Score | 100 |
Code Size | 4058 Byte |
Status | AC |
Exec Time | 1965 ms |
Memory | 59448 KB |
Judge Result
Set Name | all | ||
---|---|---|---|
Score / Max Score | 100 / 100 | ||
Status |
|
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 | 1130 ms | 40116 KB |
00_sample_02.txt | AC | 849 ms | 40232 KB |
00_sample_03.txt | AC | 865 ms | 40300 KB |
cho_cho_chokudai.txt | AC | 1927 ms | 58688 KB |
chokudai_ga_cho.txt | AC | 1907 ms | 58988 KB |
test_01.txt | AC | 940 ms | 40868 KB |
test_02.txt | AC | 936 ms | 40924 KB |
test_03.txt | AC | 942 ms | 40904 KB |
test_04.txt | AC | 952 ms | 40928 KB |
test_05.txt | AC | 934 ms | 40900 KB |
test_06.txt | AC | 901 ms | 40656 KB |
test_07.txt | AC | 869 ms | 40376 KB |
test_08.txt | AC | 858 ms | 40400 KB |
test_09.txt | AC | 946 ms | 41428 KB |
test_10.txt | AC | 963 ms | 41476 KB |
test_11.txt | AC | 958 ms | 41272 KB |
test_12.txt | AC | 938 ms | 40916 KB |
test_13.txt | AC | 889 ms | 40504 KB |
test_14.txt | AC | 964 ms | 41308 KB |
test_15.txt | AC | 975 ms | 41756 KB |
test_16.txt | AC | 871 ms | 40488 KB |
test_17.txt | AC | 972 ms | 41296 KB |
test_18.txt | AC | 906 ms | 40564 KB |
test_19.txt | AC | 935 ms | 40960 KB |
test_20.txt | AC | 944 ms | 41212 KB |
test_21.txt | AC | 1902 ms | 59140 KB |
test_22.txt | AC | 1856 ms | 59292 KB |
test_23.txt | AC | 1965 ms | 58488 KB |
test_24.txt | AC | 1848 ms | 58380 KB |
test_25.txt | AC | 1862 ms | 59060 KB |
test_26.txt | AC | 1913 ms | 59448 KB |
test_27.txt | AC | 1886 ms | 59060 KB |
test_28.txt | AC | 1874 ms | 59100 KB |
test_29.txt | AC | 965 ms | 40180 KB |
test_30.txt | AC | 881 ms | 40288 KB |
test_31.txt | AC | 1348 ms | 49920 KB |
test_32.txt | AC | 854 ms | 40180 KB |
test_33.txt | AC | 1756 ms | 58512 KB |
test_34.txt | AC | 833 ms | 40148 KB |
test_35.txt | AC | 895 ms | 40736 KB |
test_36.txt | AC | 1882 ms | 59088 KB |
test_37.txt | AC | 1870 ms | 58952 KB |
test_38.txt | AC | 1859 ms | 58616 KB |
test_39.txt | AC | 1886 ms | 58632 KB |
test_40.txt | AC | 1918 ms | 59244 KB |
test_41.txt | AC | 1878 ms | 58664 KB |
test_42.txt | AC | 1878 ms | 58456 KB |
test_43.txt | AC | 1930 ms | 58916 KB |