Submission #5352806


Source Code Expand

Copy
n = int(input())
ss = [input() for i in range(n)]

ans = sum(map(lambda x: x.count("AB"), ss))
x = y = z = 0
for s in ss:
    if s[0] == 'B' and s[-1] == 'A':
        y += 1
    elif s[-1] == 'A':
        x += 1
    elif s[0] == 'B':
        z += 1
ans += min(x,z) + y
print(ans)

Submission Info

Submission Time
Task C - AB Substrings
User sly
Language Python (3.4.3)
Score 0
Code Size 292 Byte
Status WA
Exec Time 34 ms
Memory 3700 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 0 / 400
Status
AC × 3
AC × 44
WA × 4
Set Name Test Cases
Sample sample_01.txt, sample_02.txt, sample_03.txt
All rand_01.txt, rand_02.txt, rand_03.txt, rand_04.txt, rand_05.txt, rand_06.txt, rand_07.txt, rand_08.txt, rand_09.txt, rand_10.txt, rand_11.txt, rand_12.txt, rand_13.txt, rand_14.txt, rand_15.txt, rand_16.txt, rand_17.txt, rand_18.txt, rand_19.txt, rand_20.txt, rand_21.txt, rand_22.txt, rand_23.txt, rand_24.txt, rand_25.txt, rand_26.txt, rand_27.txt, rand_28.txt, rand_29.txt, rand_30.txt, rand_31.txt, rand_32.txt, rand_33.txt, rand_34.txt, rand_35.txt, rand_36.txt, rand_37.txt, rand_38.txt, rand_39.txt, rand_40.txt, rand_41.txt, rand_42.txt, rand_43.txt, rand_44.txt, rand_45.txt, sample_01.txt, sample_02.txt, sample_03.txt
Case Name Status Exec Time Memory
rand_01.txt AC 32 ms 3700 KB
rand_02.txt AC 33 ms 3700 KB
rand_03.txt AC 33 ms 3700 KB
rand_04.txt AC 34 ms 3700 KB
rand_05.txt AC 34 ms 3700 KB
rand_06.txt AC 33 ms 3700 KB
rand_07.txt AC 33 ms 3700 KB
rand_08.txt AC 33 ms 3700 KB
rand_09.txt WA 26 ms 3444 KB
rand_10.txt WA 27 ms 3444 KB
rand_11.txt AC 20 ms 3188 KB
rand_12.txt AC 24 ms 3316 KB
rand_13.txt AC 30 ms 3572 KB
rand_14.txt AC 27 ms 3444 KB
rand_15.txt AC 26 ms 3316 KB
rand_16.txt AC 26 ms 3316 KB
rand_17.txt AC 20 ms 3064 KB
rand_18.txt AC 23 ms 3188 KB
rand_19.txt AC 20 ms 3064 KB
rand_20.txt AC 22 ms 3188 KB
rand_21.txt AC 33 ms 3700 KB
rand_22.txt AC 34 ms 3700 KB
rand_23.txt AC 32 ms 3700 KB
rand_24.txt WA 32 ms 3700 KB
rand_25.txt AC 33 ms 3700 KB
rand_26.txt AC 33 ms 3700 KB
rand_27.txt AC 25 ms 3316 KB
rand_28.txt AC 26 ms 3316 KB
rand_29.txt AC 25 ms 3316 KB
rand_30.txt AC 26 ms 3316 KB
rand_31.txt AC 23 ms 3188 KB
rand_32.txt AC 27 ms 3444 KB
rand_33.txt AC 28 ms 3444 KB
rand_34.txt AC 25 ms 3316 KB
rand_35.txt AC 25 ms 3316 KB
rand_36.txt AC 24 ms 3316 KB
rand_37.txt WA 22 ms 3188 KB
rand_38.txt AC 28 ms 3444 KB
rand_39.txt AC 26 ms 3316 KB
rand_40.txt AC 28 ms 3444 KB
rand_41.txt AC 27 ms 3444 KB
rand_42.txt AC 24 ms 3188 KB
rand_43.txt AC 27 ms 3444 KB
rand_44.txt AC 25 ms 3316 KB
rand_45.txt AC 25 ms 3316 KB
sample_01.txt AC 17 ms 3060 KB
sample_02.txt AC 17 ms 3060 KB
sample_03.txt AC 17 ms 3064 KB