Submission #41759600


Source Code Expand

# import math, heapq, bisect, itertools, functools
# from collections import deque, Counter, defaultdict, OrderedDict

# python sample.py < input.txt

if __name__ == '__main__':
    x, y, z = [int(i) for i in input().split()] # x - press, y - shift press, z - change state
    s = input()
    a, A = 0, z
    for c in s:
        if c == 'a':
            a, A = min(a + x, A + z + x), min(A + y, a + z + y)
        elif c == 'A':
            a, A = min(a + y, A + z + y), min(A + x, a + z + x)
        # print(a, A)
    print(min(a, A))
            

Submission Info

Submission Time
Task D - Shift vs. CapsLock
User shinever
Language PyPy3 (7.3.0)
Score 400
Code Size 564 Byte
Status AC
Exec Time 90 ms
Memory 73852 KiB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 400 / 400
Status
AC × 3
AC × 31
Set Name Test Cases
Sample 00_sample_00.txt, 00_sample_01.txt, 00_sample_02.txt
All 00_sample_00.txt, 00_sample_01.txt, 00_sample_02.txt, 01_small_00.txt, 01_small_01.txt, 01_small_02.txt, 01_small_03.txt, 01_small_04.txt, 01_small_05.txt, 01_small_06.txt, 01_small_07.txt, 01_small_08.txt, 01_small_09.txt, 02_rnd_00.txt, 02_rnd_01.txt, 02_rnd_02.txt, 02_rnd_03.txt, 02_rnd_04.txt, 02_rnd_05.txt, 02_rnd_06.txt, 02_rnd_07.txt, 02_rnd_08.txt, 02_rnd_09.txt, 03_max_00.txt, 03_max_01.txt, 03_max_02.txt, 03_max_03.txt, 04_border_00.txt, 04_border_01.txt, 04_border_02.txt, 04_border_03.txt
Case Name Status Exec Time Memory
00_sample_00.txt AC 90 ms 61596 KiB
00_sample_01.txt AC 53 ms 61572 KiB
00_sample_02.txt AC 52 ms 61536 KiB
01_small_00.txt AC 48 ms 61616 KiB
01_small_01.txt AC 50 ms 61568 KiB
01_small_02.txt AC 50 ms 61656 KiB
01_small_03.txt AC 47 ms 61500 KiB
01_small_04.txt AC 48 ms 61740 KiB
01_small_05.txt AC 48 ms 61620 KiB
01_small_06.txt AC 49 ms 61508 KiB
01_small_07.txt AC 48 ms 61484 KiB
01_small_08.txt AC 48 ms 61752 KiB
01_small_09.txt AC 49 ms 61488 KiB
02_rnd_00.txt AC 74 ms 73852 KiB
02_rnd_01.txt AC 69 ms 73300 KiB
02_rnd_02.txt AC 68 ms 73536 KiB
02_rnd_03.txt AC 67 ms 73676 KiB
02_rnd_04.txt AC 72 ms 73848 KiB
02_rnd_05.txt AC 72 ms 73492 KiB
02_rnd_06.txt AC 67 ms 73512 KiB
02_rnd_07.txt AC 70 ms 73336 KiB
02_rnd_08.txt AC 68 ms 73640 KiB
02_rnd_09.txt AC 62 ms 73216 KiB
03_max_00.txt AC 54 ms 65360 KiB
03_max_01.txt AC 54 ms 65384 KiB
03_max_02.txt AC 68 ms 73564 KiB
03_max_03.txt AC 63 ms 73748 KiB
04_border_00.txt AC 55 ms 65416 KiB
04_border_01.txt AC 51 ms 65680 KiB
04_border_02.txt AC 56 ms 65484 KiB
04_border_03.txt AC 55 ms 65404 KiB