Submission #7059022


Source Code Expand

N=int(input())
S=list(input())

KEY=["A","B","X","Y"]

ANS=N
for i in KEY:
    for j in KEY:
        for k in KEY:
            for l in KEY:
                m=0
                SCORE=0
                while m<N-1:
                    if S[m]==i and S[m+1]==j:
                        SCORE+=1
                        m+=2

                    elif S[m]==k and S[m+1]==l:
                        SCORE+=1
                        m+=2

                    else:
                        m+=1

                ANS=min(ANS,N-SCORE)

print(ANS)
                        
                
    

Submission Info

Submission Time
Task C - コマンド入力
User titia
Language Python (3.4.3)
Score 100
Code Size 616 Byte
Status AC
Exec Time 115 ms
Memory 3064 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 115 ms 3064 KB
00_retmin.txt AC 18 ms 3064 KB
00_sample_00.txt AC 18 ms 3060 KB
00_sample_01.txt AC 19 ms 3064 KB
00_sample_02.txt AC 18 ms 3064 KB
01_rnd_00.txt AC 101 ms 3064 KB
01_rnd_01.txt AC 109 ms 3064 KB
01_rnd_02.txt AC 97 ms 3064 KB
01_rnd_03.txt AC 94 ms 3064 KB
01_rnd_04.txt AC 93 ms 3064 KB
01_rnd_05.txt AC 106 ms 3064 KB
01_rnd_06.txt AC 108 ms 3064 KB
01_rnd_07.txt AC 95 ms 3064 KB
01_rnd_08.txt AC 97 ms 3064 KB
01_rnd_09.txt AC 98 ms 3064 KB
01_rnd_10.txt AC 96 ms 3060 KB
01_rnd_11.txt AC 96 ms 3064 KB
01_rnd_12.txt AC 96 ms 3060 KB
01_rnd_13.txt AC 109 ms 3064 KB
01_rnd_14.txt AC 99 ms 3064 KB
01_rnd_15.txt AC 107 ms 3064 KB
01_rnd_16.txt AC 101 ms 3064 KB
01_rnd_17.txt AC 92 ms 3064 KB
01_rnd_18.txt AC 99 ms 3064 KB
01_rnd_19.txt AC 93 ms 3064 KB
02_twothree_00.txt AC 98 ms 3064 KB
02_twothree_01.txt AC 109 ms 3064 KB
02_twothree_02.txt AC 91 ms 3064 KB
02_twothree_03.txt AC 101 ms 3064 KB
02_twothree_04.txt AC 96 ms 3064 KB
02_twothree_05.txt AC 102 ms 3064 KB
02_twothree_06.txt AC 102 ms 3064 KB
02_twothree_07.txt AC 91 ms 3064 KB
02_twothree_08.txt AC 94 ms 3064 KB
02_twothree_09.txt AC 106 ms 3064 KB
02_twothree_10.txt AC 95 ms 3064 KB
02_twothree_11.txt AC 97 ms 3064 KB
02_twothree_12.txt AC 96 ms 3064 KB
02_twothree_13.txt AC 96 ms 3064 KB
02_twothree_14.txt AC 108 ms 3064 KB
02_twothree_15.txt AC 95 ms 3064 KB
02_twothree_16.txt AC 103 ms 3064 KB
02_twothree_17.txt AC 96 ms 3064 KB
02_twothree_18.txt AC 98 ms 3064 KB
02_twothree_19.txt AC 98 ms 3064 KB