Submission #8323


Source Code Expand

n = STDIN.gets.to_i
command = STDIN.gets.chomp
btns = [ "A","B","X","Y" ]

len = command.length
btns.each do |u|
  btns.each do |v|
    one_replace = command.gsub u+v, "1"
    btns.each do |w|
      btns.each do |z|
        result = one_replace.gsub w+z, "2"
        len = result.length if len > result.length
      end
    end
  end
end

printf "%d\n", len

Submission Info

Submission Time
Task C - コマンド入力
User subarukun
Language Ruby (1.9.3)
Score 100
Code Size 376 Byte
Status AC
Exec Time 70 ms
Memory 4748 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 62 ms 4364 KB
00_retmin.txt AC 55 ms 4364 KB
00_sample_00.txt AC 57 ms 4352 KB
00_sample_01.txt AC 57 ms 4364 KB
00_sample_02.txt AC 57 ms 4360 KB
01_rnd_00.txt AC 65 ms 4616 KB
01_rnd_01.txt AC 65 ms 4616 KB
01_rnd_02.txt AC 64 ms 4652 KB
01_rnd_03.txt AC 65 ms 4620 KB
01_rnd_04.txt AC 65 ms 4732 KB
01_rnd_05.txt AC 64 ms 4620 KB
01_rnd_06.txt AC 67 ms 4624 KB
01_rnd_07.txt AC 65 ms 4620 KB
01_rnd_08.txt AC 66 ms 4624 KB
01_rnd_09.txt AC 65 ms 4728 KB
01_rnd_10.txt AC 70 ms 4620 KB
01_rnd_11.txt AC 64 ms 4740 KB
01_rnd_12.txt AC 66 ms 4620 KB
01_rnd_13.txt AC 64 ms 4624 KB
01_rnd_14.txt AC 64 ms 4624 KB
01_rnd_15.txt AC 65 ms 4748 KB
01_rnd_16.txt AC 63 ms 4628 KB
01_rnd_17.txt AC 65 ms 4616 KB
01_rnd_18.txt AC 63 ms 4620 KB
01_rnd_19.txt AC 65 ms 4740 KB
02_twothree_00.txt AC 63 ms 4492 KB
02_twothree_01.txt AC 64 ms 4496 KB
02_twothree_02.txt AC 65 ms 4500 KB
02_twothree_03.txt AC 64 ms 4624 KB
02_twothree_04.txt AC 62 ms 4496 KB
02_twothree_05.txt AC 64 ms 4488 KB
02_twothree_06.txt AC 63 ms 4496 KB
02_twothree_07.txt AC 64 ms 4492 KB
02_twothree_08.txt AC 64 ms 4492 KB
02_twothree_09.txt AC 63 ms 4500 KB
02_twothree_10.txt AC 64 ms 4488 KB
02_twothree_11.txt AC 65 ms 4492 KB
02_twothree_12.txt AC 66 ms 4524 KB
02_twothree_13.txt AC 63 ms 4492 KB
02_twothree_14.txt AC 61 ms 4488 KB
02_twothree_15.txt AC 62 ms 4472 KB
02_twothree_16.txt AC 63 ms 4488 KB
02_twothree_17.txt AC 64 ms 4492 KB
02_twothree_18.txt AC 64 ms 4492 KB
02_twothree_19.txt AC 63 ms 4492 KB