Submission #65977


Source Code Expand

main = do
	_ <- getLine
	command <- getLine
	putStrLn $ ( show . minimum . solve ) command

solve :: String -> [Int]
solve command = [ count [ l1, l2 ] [ r1, r2 ] command | l1 <- buttons, l2 <- buttons, r1 <- buttons, r2 <- buttons ]
	where
		buttons = [ 'A', 'B', 'X', 'Y' ]

		count :: String -> String -> String -> Int
		count _ _ [] = 0
		count ls rs command
			| 2 <= length command && ( take 2 command == ls || take 2 command == rs ) = 1 + ( count ls rs $ drop 2 command )
			| otherwise = 1 + ( count ls rs $ tail command )

Submission Info

Submission Time
Task C - コマンド入力
User torus711
Language Haskell (GHC 7.4.1)
Score 100
Code Size 546 Byte
Status AC
Exec Time 453 ms
Memory 1724 KB

Judge Result

Set Name All
Score / Max Score 100 / 100
Status
AC × 45
Set Name Test Cases
All 00_retmax.txt, 00_retmin.txt, 00_sample_00.txt, 00_sample_01.txt, 00_sample_02.txt, 01_rnd_00.txt, 01_rnd_01.txt, 01_rnd_02.txt, 01_rnd_03.txt, 01_rnd_04.txt, 01_rnd_05.txt, 01_rnd_06.txt, 01_rnd_07.txt, 01_rnd_08.txt, 01_rnd_09.txt, 01_rnd_10.txt, 01_rnd_11.txt, 01_rnd_12.txt, 01_rnd_13.txt, 01_rnd_14.txt, 01_rnd_15.txt, 01_rnd_16.txt, 01_rnd_17.txt, 01_rnd_18.txt, 01_rnd_19.txt, 02_twothree_00.txt, 02_twothree_01.txt, 02_twothree_02.txt, 02_twothree_03.txt, 02_twothree_04.txt, 02_twothree_05.txt, 02_twothree_06.txt, 02_twothree_07.txt, 02_twothree_08.txt, 02_twothree_09.txt, 02_twothree_10.txt, 02_twothree_11.txt, 02_twothree_12.txt, 02_twothree_13.txt, 02_twothree_14.txt, 02_twothree_15.txt, 02_twothree_16.txt, 02_twothree_17.txt, 02_twothree_18.txt, 02_twothree_19.txt
Case Name Status Exec Time Memory
00_retmax.txt AC 453 ms 1660 KB
00_retmin.txt AC 24 ms 1140 KB
00_sample_00.txt AC 24 ms 1424 KB
00_sample_01.txt AC 26 ms 1548 KB
00_sample_02.txt AC 25 ms 1420 KB
01_rnd_00.txt AC 368 ms 1648 KB
01_rnd_01.txt AC 362 ms 1648 KB
01_rnd_02.txt AC 360 ms 1648 KB
01_rnd_03.txt AC 362 ms 1724 KB
01_rnd_04.txt AC 363 ms 1648 KB
01_rnd_05.txt AC 362 ms 1656 KB
01_rnd_06.txt AC 361 ms 1648 KB
01_rnd_07.txt AC 360 ms 1648 KB
01_rnd_08.txt AC 361 ms 1648 KB
01_rnd_09.txt AC 362 ms 1648 KB
01_rnd_10.txt AC 363 ms 1664 KB
01_rnd_11.txt AC 364 ms 1580 KB
01_rnd_12.txt AC 368 ms 1652 KB
01_rnd_13.txt AC 363 ms 1652 KB
01_rnd_14.txt AC 361 ms 1648 KB
01_rnd_15.txt AC 363 ms 1644 KB
01_rnd_16.txt AC 369 ms 1652 KB
01_rnd_17.txt AC 369 ms 1656 KB
01_rnd_18.txt AC 365 ms 1648 KB
01_rnd_19.txt AC 362 ms 1648 KB
02_twothree_00.txt AC 361 ms 1712 KB
02_twothree_01.txt AC 358 ms 1648 KB
02_twothree_02.txt AC 360 ms 1656 KB
02_twothree_03.txt AC 355 ms 1648 KB
02_twothree_04.txt AC 361 ms 1684 KB
02_twothree_05.txt AC 361 ms 1704 KB
02_twothree_06.txt AC 359 ms 1652 KB
02_twothree_07.txt AC 361 ms 1656 KB
02_twothree_08.txt AC 360 ms 1648 KB
02_twothree_09.txt AC 362 ms 1628 KB
02_twothree_10.txt AC 358 ms 1648 KB
02_twothree_11.txt AC 356 ms 1644 KB
02_twothree_12.txt AC 359 ms 1648 KB
02_twothree_13.txt AC 356 ms 1652 KB
02_twothree_14.txt AC 360 ms 1648 KB
02_twothree_15.txt AC 359 ms 1648 KB
02_twothree_16.txt AC 358 ms 1600 KB
02_twothree_17.txt AC 357 ms 1712 KB
02_twothree_18.txt AC 357 ms 1644 KB
02_twothree_19.txt AC 360 ms 1652 KB