AtCoder Beginner Contest 001

Submission #179545

Source codeソースコード

import scala.collection.mutable.ArrayBuffer

object Main{
	def main(args: Array[String]): Unit = {
	  var table = new Array[Int](300)
	  for( i <- 0 until readInt) {
	  	var s = readLine.split("-").map(_.toInt)
	  	table(time2Num(sModify(s(0)))) += 1
	  	table(time2Num(eModify(s(1)))) -= 1
	  }
	  var start = 0
	  var end = 0
	  var c = 0
	  var t = true
	  for(i <- 0 until table.length){
	  	c += table(i)
	  	if(c != 0 && t){
	  		start = i
	  		t = !t
	  	}
	  	if(c == 0 && !t){
	  		end = i
	  		t = !t
	  		printf("%04d-%04d\n", num2Time(start), num2Time(end))
	  	}
	  }
	}
	def sModify(x: Int) = x - (x % 10 % 5)
	def eModify(x: Int): Int = {
		var ret = x;
		if(x % 10 % 5 != 0) ret = x + 5 - x % 10 % 5
		if(ret % 100 == 60) ret = ret + 40
		return ret
	}
	def time2Num(x: Int): Int = {
		var h = x / 100
		var m = x % 100
		h * 12 + m / 5
	}
	def num2Time(x: Int): Int = {
		var h = x / 12
		var m = x % 12
		h * 100 + m * 5
	}
}

Submission

Task問題 D - 感雨時刻の整理
User nameユーザ名 ArchamR
Created time投稿日時
Language言語 Scala (2.9.1)
Status状態 AC
Score得点 100
Source lengthソースコード長 987 Byte
File nameファイル名
Exec time実行時間 1576 ms
Memory usageメモリ使用量 51080 KB

Test case

Set

Set name Score得点 / Max score Cases
all 100 / 100 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

Test case

Case name Status状態 Exec time実行時間 Memory usageメモリ使用量
00_sample_01.txt AC 948 ms 39236 KB
00_sample_02.txt AC 943 ms 39176 KB
00_sample_03.txt AC 915 ms 39260 KB
cho_cho_chokudai.txt AC 1331 ms 49960 KB
chokudai_ga_cho.txt AC 1262 ms 50624 KB
test_01.txt AC 956 ms 39476 KB
test_02.txt AC 943 ms 39612 KB
test_03.txt AC 958 ms 39640 KB
test_04.txt AC 974 ms 39740 KB
test_05.txt AC 950 ms 39672 KB
test_06.txt AC 956 ms 39504 KB
test_07.txt AC 918 ms 39376 KB
test_08.txt AC 919 ms 39204 KB
test_09.txt AC 943 ms 39644 KB
test_10.txt AC 946 ms 39488 KB
test_11.txt AC 957 ms 39484 KB
test_12.txt AC 952 ms 39392 KB
test_13.txt AC 928 ms 39328 KB
test_14.txt AC 937 ms 39584 KB
test_15.txt AC 941 ms 39636 KB
test_16.txt AC 932 ms 39336 KB
test_17.txt AC 956 ms 39480 KB
test_18.txt AC 912 ms 39340 KB
test_19.txt AC 942 ms 39508 KB
test_20.txt AC 950 ms 39524 KB
test_21.txt AC 1334 ms 49372 KB
test_22.txt AC 1297 ms 50164 KB
test_23.txt AC 1313 ms 50100 KB
test_24.txt AC 1314 ms 49884 KB
test_25.txt AC 1576 ms 49632 KB
test_26.txt AC 1437 ms 51080 KB
test_27.txt AC 1338 ms 49280 KB
test_28.txt AC 1298 ms 49744 KB
test_29.txt AC 943 ms 39240 KB
test_30.txt AC 920 ms 39340 KB
test_31.txt AC 1118 ms 43656 KB
test_32.txt AC 903 ms 39340 KB
test_33.txt AC 1332 ms 51000 KB
test_34.txt AC 951 ms 39144 KB
test_35.txt AC 929 ms 39348 KB
test_36.txt AC 1337 ms 50008 KB
test_37.txt AC 1363 ms 49756 KB
test_38.txt AC 1294 ms 50328 KB
test_39.txt AC 1263 ms 50672 KB
test_40.txt AC 1304 ms 50352 KB
test_41.txt AC 1345 ms 50880 KB
test_42.txt AC 1270 ms 50052 KB
test_43.txt AC 1264 ms 50228 KB