Submission #73701808


Source Code Expand

S = input()
T = input()
mS = []
nS = []
cnt = 0
for i in S:
  if i == "A":
    cnt += 1
  else:
    mS.append(cnt)
    nS.append(i)
    cnt = 0
if S[-1] == "A":
  mS.append(cnt)
else:
  mS.append(0)
mT = []
nT = []
cnt = 0
for i in T:
  if i == "A":
    cnt += 1
  else:
    mT.append(cnt)
    nT.append(i)
    cnt = 0
if T[-1] == "A":
  mT.append(cnt)
else:
  mT.append(0)
if nS == nT:
  cnt = 0
  for i in range(len(mS)):
    cnt += abs(mS[i] - mT[i])
  print(cnt)
else:
  print(-1)

Submission Info

Submission Time
Task C - Insert and Erase A
User tai_97427
Language Python (PyPy 3.11-v7.3.20)
Score 300
Code Size 520 Byte
Status AC
Exec Time 114 ms
Memory 184672 KiB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 300 / 300
Status
AC × 4
AC × 33
Set Name Test Cases
Sample 00_sample_00.txt, 00_sample_01.txt, 00_sample_02.txt, 00_sample_03.txt
All 00_sample_00.txt, 00_sample_01.txt, 00_sample_02.txt, 00_sample_03.txt, 01_random_00.txt, 01_random_01.txt, 01_random_02.txt, 02_random2_00.txt, 02_random2_01.txt, 02_random2_02.txt, 02_random2_03.txt, 02_random2_04.txt, 02_random2_05.txt, 02_random2_06.txt, 02_random2_07.txt, 02_random2_08.txt, 02_random2_09.txt, 02_random2_10.txt, 02_random2_11.txt, 03_random3_00.txt, 03_random3_01.txt, 03_random3_02.txt, 03_random3_03.txt, 04_handmade_00.txt, 04_handmade_01.txt, 04_handmade_02.txt, 04_handmade_03.txt, 04_handmade_04.txt, 04_handmade_05.txt, 04_handmade_06.txt, 04_handmade_07.txt, 04_handmade_08.txt, 04_handmade_09.txt
Case Name Status Exec Time Memory
00_sample_00.txt AC 50 ms 79696 KiB
00_sample_01.txt AC 49 ms 80016 KiB
00_sample_02.txt AC 50 ms 79648 KiB
00_sample_03.txt AC 49 ms 79648 KiB
01_random_00.txt AC 69 ms 117992 KiB
01_random_01.txt AC 87 ms 146788 KiB
01_random_02.txt AC 114 ms 164604 KiB
02_random2_00.txt AC 99 ms 145892 KiB
02_random2_01.txt AC 73 ms 111364 KiB
02_random2_02.txt AC 113 ms 158352 KiB
02_random2_03.txt AC 109 ms 155404 KiB
02_random2_04.txt AC 98 ms 137832 KiB
02_random2_05.txt AC 78 ms 121440 KiB
02_random2_06.txt AC 102 ms 147452 KiB
02_random2_07.txt AC 71 ms 112584 KiB
02_random2_08.txt AC 81 ms 122528 KiB
02_random2_09.txt AC 88 ms 127980 KiB
02_random2_10.txt AC 107 ms 150060 KiB
02_random2_11.txt AC 112 ms 159044 KiB
03_random3_00.txt AC 114 ms 167492 KiB
03_random3_01.txt AC 85 ms 129156 KiB
03_random3_02.txt AC 102 ms 149924 KiB
03_random3_03.txt AC 91 ms 133808 KiB
04_handmade_00.txt AC 50 ms 79904 KiB
04_handmade_01.txt AC 50 ms 79884 KiB
04_handmade_02.txt AC 49 ms 79792 KiB
04_handmade_03.txt AC 50 ms 80016 KiB
04_handmade_04.txt AC 106 ms 184672 KiB
04_handmade_05.txt AC 89 ms 153716 KiB
04_handmade_06.txt AC 92 ms 152028 KiB
04_handmade_07.txt AC 56 ms 89312 KiB
04_handmade_08.txt AC 53 ms 87500 KiB
04_handmade_09.txt AC 53 ms 87000 KiB